@@ -376,58 +376,6 @@ def test_trainer_load_trained_ckpts(config, tmp_path, minimal_instance_ckpt):
376376 assert np .all (np .abs (head_layer_ckpt - model_ckpt ) < 1e-6 )
377377
378378
379- @pytest .mark .skipif (
380- sys .platform .startswith ("li" ),
381- reason = "Flaky test (The training test runs on Ubuntu for a long time: >6hrs and then fails.)" ,
382- )
383- # TODO: Revisit this test later (Failing on ubuntu)
384- def test_reuse_bin_files (config , tmp_path : str ):
385- """Test reusing `.bin` files."""
386- # Centroid model
387- centroid_config = config .copy ()
388- head_config = config .model_config .head_configs .centered_instance
389- OmegaConf .update (centroid_config , "model_config.head_configs.centroid" , head_config )
390- del centroid_config .model_config .head_configs .centered_instance
391- del centroid_config .model_config .head_configs .centroid ["confmaps" ].part_names
392-
393- OmegaConf .update (
394- centroid_config ,
395- "trainer_config.save_ckpt_path" ,
396- f"{ tmp_path } /test_model_trainer/" ,
397- )
398-
399- if (Path (centroid_config .trainer_config .save_ckpt_path ) / "best.ckpt" ).exists ():
400- os .remove (
401- (
402- Path (centroid_config .trainer_config .save_ckpt_path ) / "best.ckpt"
403- ).as_posix ()
404- )
405- os .remove (
406- (
407- Path (centroid_config .trainer_config .save_ckpt_path ) / "last.ckpt"
408- ).as_posix ()
409- )
410- shutil .rmtree (
411- (
412- Path (centroid_config .trainer_config .save_ckpt_path ) / "lightning_logs"
413- ).as_posix ()
414- )
415-
416- OmegaConf .update (centroid_config , "trainer_config.save_ckpt" , True )
417- OmegaConf .update (centroid_config , "trainer_config.use_wandb" , False )
418- OmegaConf .update (centroid_config , "trainer_config.max_epochs" , 1 )
419- OmegaConf .update (centroid_config , "trainer_config.steps_per_epoch" , 10 )
420-
421- # test reusing bin files
422- trainer1 = ModelTrainer (centroid_config )
423- trainer1 .train (delete_bin_files_after_training = False )
424-
425- trainer2 = ModelTrainer (centroid_config )
426- trainer2 .train (
427- chunks_dir_path = (trainer1 .train_input_dir ).split ("train_chunks" )[0 ],
428- )
429-
430-
431379def test_topdown_centered_instance_model (config , tmp_path : str ):
432380
433381 # unet
0 commit comments