Skip to content

Commit c846b6d

Browse files
Fix type conversion for folds and improve input_files type checking in ModelnnUNetWrapper
1 parent fcf5ac0 commit c846b6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

monai/bundle/nnunet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def __init__(self, predictor, model_folder, model_name="model.pt"):
200200

201201
parameters = []
202202
for i, f in enumerate(use_folds):
203-
f = int(f) if f != "all" else f
203+
f = str(f) if f != "all" else f
204204
checkpoint = torch.load(
205205
join(model_training_output_dir, "nnunet_checkpoint.pth"), map_location=torch.device("cpu")
206206
)
@@ -263,7 +263,7 @@ def forward(self, x):
263263
input_files = [img.meta["filename_or_obj"][0] for img in x]
264264
else: # if batch is collated
265265
input_files = x.meta["filename_or_obj"]
266-
if type(input_files) is str:
266+
if isinstance(input_files, str):
267267
input_files = [input_files]
268268

269269
# input_files should be a list of file paths, one per modality

0 commit comments

Comments
 (0)