Skip to content

Remove deprecated functionality for v1.5 #8430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 9, 2025

Conversation

KumoLiu
Copy link
Contributor

@KumoLiu KumoLiu commented Apr 25, 2025

remove deprecated functionality

Part of #8421

Description

Removed Functionality:

  • metrics: Removed compute_percent_hausdorff_distance. Use compute_hausdorff_distance with the percentile argument instead.
  • bundle: Removed net_name, net_kwargs, and return_state_dict arguments from load(). Use the model argument for network instantiation.
  • bundle: Removed workflow argument from BundleWorkflow and ConfigWorkflow. Use workflow_type instead.
  • networks: Removed img_size argument from SwinUNETR. Input size checks are now performed during forward().

Default Value Changes:

  • GeneralizedDiceScore: Changed default reduction from MEAN_BATCH to MEAN.
  • CropForeground / CropForegroundd: Changed default allow_smaller from True to False.
  • get_mask_edges: Changed default always_return_as_numpy from True to False.
  • generate_spatial_bounding_box: Changed default allow_smaller from True to False.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@KumoLiu KumoLiu requested a review from ericspod April 27, 2025 09:13
KumoLiu added 2 commits April 27, 2025 17:15
Signed-off-by: YunLiu <[email protected]>
Signed-off-by: YunLiu <[email protected]>
@KumoLiu
Copy link
Contributor Author

KumoLiu commented May 8, 2025

/build

@KumoLiu
Copy link
Contributor Author

KumoLiu commented May 9, 2025

Error log:

[2025-05-08T08:11:12.365Z] ======================================================================
[2025-05-08T08:11:12.365Z] ERROR: test_get_history (tests.integration.test_auto3dseg_hpo.TestHPO)
[2025-05-08T08:11:12.365Z] ----------------------------------------------------------------------
[2025-05-08T08:11:12.365Z] Traceback (most recent call last):
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/integration/test_auto3dseg_hpo.py", line 180, in test_get_history
[2025-05-08T08:11:12.365Z]     NNIGen().run_algo(obj_filename, self.work_dir)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/hpo_gen.py", line 233, in run_algo
[2025-05-08T08:11:12.365Z]     self.algo.train(self.params)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/bundle_gen.py", line 300, in train
[2025-05-08T08:11:12.365Z]     return self._run_cmd(cmd)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/bundle_gen.py", line 277, in _run_cmd
[2025-05-08T08:11:12.365Z]     return run_cmd(cmd.split(), run_cmd_verbose=True, env=ps_environ, check=True)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/utils/misc.py", line 892, in run_cmd
[2025-05-08T08:11:12.365Z]     return subprocess.run(cmd_list, **kwargs)
[2025-05-08T08:11:12.365Z]   File "/usr/lib/python3.10/subprocess.py", line 526, in run
[2025-05-08T08:11:12.365Z]     raise CalledProcessError(retcode, process.args,
[2025-05-08T08:11:12.365Z] subprocess.CalledProcessError: Command '['python', '/tmp/tmpz6gujw0_/workdir/swinunetr_0_override_None/scripts/train.py', 'run', "--config_file='/tmp/tmpz6gujw0_/workdir/swinunetr_0_override_None/configs/hyper_parameters.yaml,/tmp/tmpz6gujw0_/workdir/swinunetr_0_override_None/configs/network.yaml,/tmp/tmpz6gujw0_/workdir/swinunetr_0_override_None/configs/transforms_infer.yaml,/tmp/tmpz6gujw0_/workdir/swinunetr_0_override_None/configs/transforms_train.yaml,/tmp/tmpz6gujw0_/workdir/swinunetr_0_override_None/configs/transforms_validate.yaml'"]' returned non-zero exit status 1.
[2025-05-08T08:11:12.365Z] 
[2025-05-08T08:11:12.365Z] ======================================================================
[2025-05-08T08:11:12.365Z] ERROR: test_run_algo (tests.integration.test_auto3dseg_hpo.TestHPO)
[2025-05-08T08:11:12.365Z] ----------------------------------------------------------------------
[2025-05-08T08:11:12.365Z] Traceback (most recent call last):
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/integration/test_auto3dseg_hpo.py", line 148, in test_run_algo
[2025-05-08T08:11:12.365Z]     NNIGen().run_algo(obj_filename, self.work_dir)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/hpo_gen.py", line 233, in run_algo
[2025-05-08T08:11:12.365Z]     self.algo.train(self.params)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/bundle_gen.py", line 300, in train
[2025-05-08T08:11:12.365Z]     return self._run_cmd(cmd)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/bundle_gen.py", line 277, in _run_cmd
[2025-05-08T08:11:12.365Z]     return run_cmd(cmd.split(), run_cmd_verbose=True, env=ps_environ, check=True)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/utils/misc.py", line 892, in run_cmd
[2025-05-08T08:11:12.365Z]     return subprocess.run(cmd_list, **kwargs)
[2025-05-08T08:11:12.365Z]   File "/usr/lib/python3.10/subprocess.py", line 526, in run
[2025-05-08T08:11:12.365Z]     raise CalledProcessError(retcode, process.args,
[2025-05-08T08:11:12.365Z] subprocess.CalledProcessError: Command '['python', '/tmp/tmpg8livo0_/workdir/swinunetr_0_override_None/scripts/train.py', 'run', "--config_file='/tmp/tmpg8livo0_/workdir/swinunetr_0_override_None/configs/hyper_parameters.yaml,/tmp/tmpg8livo0_/workdir/swinunetr_0_override_None/configs/network.yaml,/tmp/tmpg8livo0_/workdir/swinunetr_0_override_None/configs/transforms_infer.yaml,/tmp/tmpg8livo0_/workdir/swinunetr_0_override_None/configs/transforms_train.yaml,/tmp/tmpg8livo0_/workdir/swinunetr_0_override_None/configs/transforms_validate.yaml'"]' returned non-zero exit status 1.
[2025-05-08T08:11:12.365Z] 
[2025-05-08T08:11:12.365Z] ======================================================================
[2025-05-08T08:11:12.365Z] ERROR: test_run_optuna (tests.integration.test_auto3dseg_hpo.TestHPO)
[2025-05-08T08:11:12.365Z] ----------------------------------------------------------------------
[2025-05-08T08:11:12.365Z] Traceback (most recent call last):
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/integration/test_auto3dseg_hpo.py", line 163, in test_run_optuna
[2025-05-08T08:11:12.365Z]     study.optimize(
[2025-05-08T08:11:12.365Z]   File "/usr/local/lib/python3.10/dist-packages/optuna/study/study.py", line 475, in optimize
[2025-05-08T08:11:12.365Z]     _optimize(
[2025-05-08T08:11:12.365Z]   File "/usr/local/lib/python3.10/dist-packages/optuna/study/_optimize.py", line 63, in _optimize
[2025-05-08T08:11:12.365Z]     _optimize_sequential(
[2025-05-08T08:11:12.365Z]   File "/usr/local/lib/python3.10/dist-packages/optuna/study/_optimize.py", line 160, in _optimize_sequential
[2025-05-08T08:11:12.365Z]     frozen_trial = _run_trial(study, func, catch)
[2025-05-08T08:11:12.365Z]   File "/usr/local/lib/python3.10/dist-packages/optuna/study/_optimize.py", line 248, in _run_trial
[2025-05-08T08:11:12.365Z]     raise func_err
[2025-05-08T08:11:12.365Z]   File "/usr/local/lib/python3.10/dist-packages/optuna/study/_optimize.py", line 197, in _run_trial
[2025-05-08T08:11:12.365Z]     value_or_values = func(trial)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/hpo_gen.py", line 338, in __call__
[2025-05-08T08:11:12.365Z]     self.run_algo(obj_filename, output_folder, template_path)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/hpo_gen.py", line 396, in run_algo
[2025-05-08T08:11:12.365Z]     self.algo.train(self.params)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/bundle_gen.py", line 300, in train
[2025-05-08T08:11:12.365Z]     return self._run_cmd(cmd)
[2025-05-08T08:11:12.365Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/auto3dseg/bundle_gen.py", line 277, in _run_cmd
[2025-05-08T08:11:12.365Z]     return run_cmd(cmd.split(), run_cmd_verbose=True, env=ps_environ, check=True)
[2025-05-08T08:11:12.366Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/utils/misc.py", line 892, in run_cmd
[2025-05-08T08:11:12.366Z]     return subprocess.run(cmd_list, **kwargs)
[2025-05-08T08:11:12.366Z]   File "/usr/lib/python3.10/subprocess.py", line 526, in run
[2025-05-08T08:11:12.366Z]     raise CalledProcessError(retcode, process.args,
[2025-05-08T08:11:12.366Z] subprocess.CalledProcessError: Command '['python', '/tmp/tmpjt2los39/optuna_test/swinunetr_0_override_learning_rate_0.01/scripts/train.py', 'run', "--config_file='/tmp/tmpjt2los39/optuna_test/swinunetr_0_override_learning_rate_0.01/configs/hyper_parameters.yaml,/tmp/tmpjt2los39/optuna_test/swinunetr_0_override_learning_rate_0.01/configs/network.yaml,/tmp/tmpjt2los39/optuna_test/swinunetr_0_override_learning_rate_0.01/configs/transforms_infer.yaml,/tmp/tmpjt2los39/optuna_test/swinunetr_0_override_learning_rate_0.01/configs/transforms_train.yaml,/tmp/tmpjt2los39/optuna_test/swinunetr_0_override_learning_rate_0.01/configs/transforms_validate.yaml'", '--learning_rate=0.01']' returned non-zero exit status 1.

@ericspod
Copy link
Member

ericspod commented May 9, 2025

Hi @KumoLiu can you set MONAI_DEBUG=1 in the blossom script? This should cause the commands that are failing to save their outputs, this statement is causing the output to be discarded.

KumoLiu added a commit to Project-MONAI/research-contributions that referenced this pull request May 9, 2025
Remove deprecated `img_size` args in `SwinUNETR`
Add `allow_smaller=True` in CropForeground / CropForegroundd since
default value has been changed

Project-MONAI/MONAI#8430

---------

Signed-off-by: YunLiu <[email protected]>
@KumoLiu
Copy link
Contributor Author

KumoLiu commented May 9, 2025

Hi @KumoLiu can you set MONAI_DEBUG=1 in the blossom script? This should cause the commands that are failing to save their outputs, this statement is causing the output to be discarded.

Hi @ericspod, it should be fixed by this PR: Project-MONAI/research-contributions#416.
If not, I will try to add MONAI_DEBUG=1.

@KumoLiu
Copy link
Contributor Author

KumoLiu commented May 9, 2025

/build

@KumoLiu
Copy link
Contributor Author

KumoLiu commented May 9, 2025

Identify the issue: There’s a dependency between this one and #8443. They must be merged simultaneously. If the changes to core aren’t merged, the algo adjustments won’t function properly.

@ericspod
Copy link
Member

ericspod commented May 9, 2025

Identify the issue: There’s a dependency between this one and #8443. They must be merged simultaneously. If the changes to core aren’t merged, the algo adjustments won’t function properly.

OK it's fine to just copy the change from #8443 here then.

@KumoLiu KumoLiu enabled auto-merge (squash) May 9, 2025 15:40
@KumoLiu KumoLiu merged commit f97a0e9 into Project-MONAI:dev May 9, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants