From e64f7652b76034efc5323eb9a153fd0da566e2ae Mon Sep 17 00:00:00 2001 From: Mingxin Zheng Date: Wed, 27 Mar 2024 03:23:38 +0000 Subject: [PATCH 1/5] Fix bundle_root for NNIGen Signed-off-by: Mingxin Zheng --- monai/apps/auto3dseg/hpo_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/apps/auto3dseg/hpo_gen.py b/monai/apps/auto3dseg/hpo_gen.py index 688bf2b916..99e69366dc 100644 --- a/monai/apps/auto3dseg/hpo_gen.py +++ b/monai/apps/auto3dseg/hpo_gen.py @@ -193,7 +193,7 @@ def generate(self, output_folder: str = ".") -> None: self.obj_filename = os.path.join(write_path, "algo_object.pkl") if isinstance(self.algo, BundleAlgo): - self.algo.export_to_disk(output_folder, task_prefix + task_id, fill_with_datastats=False) + self.algo.export_to_disk(output_folder, task_prefix + task_id, bundle_root=write_path, fill_with_datastats=False) else: ConfigParser.export_config_file(self.params, write_path) logger.info(write_path) From 3b63fb453aefc636ef4cb08b8142b6244d0a62a6 Mon Sep 17 00:00:00 2001 From: Mingxin Zheng Date: Wed, 27 Mar 2024 04:07:03 +0000 Subject: [PATCH 2/5] fix format Signed-off-by: Mingxin Zheng --- monai/apps/auto3dseg/hpo_gen.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/monai/apps/auto3dseg/hpo_gen.py b/monai/apps/auto3dseg/hpo_gen.py index 99e69366dc..88538d50f3 100644 --- a/monai/apps/auto3dseg/hpo_gen.py +++ b/monai/apps/auto3dseg/hpo_gen.py @@ -193,7 +193,12 @@ def generate(self, output_folder: str = ".") -> None: self.obj_filename = os.path.join(write_path, "algo_object.pkl") if isinstance(self.algo, BundleAlgo): - self.algo.export_to_disk(output_folder, task_prefix + task_id, bundle_root=write_path, fill_with_datastats=False) + self.algo.export_to_disk( + output_folder, + task_prefix + task_id, + bundle_root=write_path, + fill_with_datastats=False + ) else: ConfigParser.export_config_file(self.params, write_path) logger.info(write_path) From 772966f550baefb5266a2d88023ffac8d83c3893 Mon Sep 17 00:00:00 2001 From: Mingxin Zheng Date: Wed, 27 Mar 2024 04:07:36 +0000 Subject: [PATCH 3/5] fix format Signed-off-by: Mingxin Zheng --- monai/apps/auto3dseg/hpo_gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/apps/auto3dseg/hpo_gen.py b/monai/apps/auto3dseg/hpo_gen.py index 88538d50f3..54e90882c8 100644 --- a/monai/apps/auto3dseg/hpo_gen.py +++ b/monai/apps/auto3dseg/hpo_gen.py @@ -197,7 +197,7 @@ def generate(self, output_folder: str = ".") -> None: output_folder, task_prefix + task_id, bundle_root=write_path, - fill_with_datastats=False + fill_with_datastats=False, ) else: ConfigParser.export_config_file(self.params, write_path) From c107b10d491f9cc6f14f60917506777f4bd80f88 Mon Sep 17 00:00:00 2001 From: Mingxin Zheng Date: Wed, 27 Mar 2024 06:41:24 +0000 Subject: [PATCH 4/5] autofix Signed-off-by: Mingxin Zheng --- monai/apps/auto3dseg/hpo_gen.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/monai/apps/auto3dseg/hpo_gen.py b/monai/apps/auto3dseg/hpo_gen.py index 54e90882c8..b755b99feb 100644 --- a/monai/apps/auto3dseg/hpo_gen.py +++ b/monai/apps/auto3dseg/hpo_gen.py @@ -194,10 +194,7 @@ def generate(self, output_folder: str = ".") -> None: if isinstance(self.algo, BundleAlgo): self.algo.export_to_disk( - output_folder, - task_prefix + task_id, - bundle_root=write_path, - fill_with_datastats=False, + output_folder, task_prefix + task_id, bundle_root=write_path, fill_with_datastats=False ) else: ConfigParser.export_config_file(self.params, write_path) From 386b17b5d237512fa289099ca87c8124326b7a67 Mon Sep 17 00:00:00 2001 From: Mingxin Zheng Date: Wed, 27 Mar 2024 08:17:44 +0000 Subject: [PATCH 5/5] fix test Signed-off-by: Mingxin Zheng --- tests/test_auto3dseg_hpo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_auto3dseg_hpo.py b/tests/test_auto3dseg_hpo.py index 34d00336ec..53d09defa0 100644 --- a/tests/test_auto3dseg_hpo.py +++ b/tests/test_auto3dseg_hpo.py @@ -181,7 +181,7 @@ def test_get_history(self) -> None: NNIGen().run_algo(obj_filename, self.work_dir) history = import_bundle_algo_history(self.work_dir, only_trained=True) - assert len(history) == 3 + assert len(history) == 1 def tearDown(self) -> None: self.test_dir.cleanup()