Skip to content

Commit

Permalink
Restrict Auto3DSeg fold input based on datalist (#7778)
Browse files Browse the repository at this point in the history
Fixes #7777.

### Description

Lower the maximum `num_fold` allowed for user inputs in Auto3DSeg
AutoRunner

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [x] In-line docstrings updated.

Signed-off-by: Mingxin Zheng <[email protected]>
Co-authored-by: YunLiu <[email protected]>
  • Loading branch information
mingxin-zheng and KumoLiu authored May 17, 2024
1 parent 7429e2a commit d0d1292
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions monai/apps/auto3dseg/auto_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ def set_num_fold(self, num_fold: int = 5) -> AutoRunner:

if num_fold <= 0:
raise ValueError(f"num_fold is expected to be an integer greater than zero. Now it gets {num_fold}")
if num_fold > self.max_fold + 1:
# Auto3DSeg allows no validation set, so the maximum fold number is max_fold + 1
if num_fold > self.max_fold:
# Auto3DSeg must contain validation set, so the maximum fold number is max_fold.
raise ValueError(
f"num_fold is greater than the maximum fold number {self.max_fold} in {self.datalist_filename}."
)
Expand Down

0 comments on commit d0d1292

Please sign in to comment.