Skip to content

Commit db5ae69

Browse files
Fix model name check in ModelnnUNetWrapper to ensure it ends with .pt before loading
1 parent f2dbc26 commit db5ae69

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

monai/apps/nnunet/nnunet_bundle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def __init__(self, predictor: object, model_folder: Union[str, Path], model_name
210210
configuration_name = nnunet_config["configuration"]
211211
inference_allowed_mirroring_axes = nnunet_config["inference_allowed_mirroring_axes"]
212212

213-
if Path(model_training_output_dir).joinpath(model_name).is_file():
213+
if Path(model_training_output_dir).joinpath(model_name).is_file() and model_name.endswith(".pt"):
214214
monai_checkpoint = torch.load(join(model_training_output_dir, model_name), map_location=torch.device("cpu"))
215215
if "network_weights" in monai_checkpoint.keys():
216216
parameters.append(monai_checkpoint["network_weights"])

0 commit comments

Comments
 (0)