@@ -182,7 +182,9 @@ def __init__(self, predictor: object, model_folder: Union[str, Path], model_name
182182 parameters = []
183183
184184 checkpoint = torch .load (
185- join (Path (model_training_output_dir ).parent , "nnunet_checkpoint.pth" ), map_location = torch .device ("cpu" ), weights_only = True
185+ join (Path (model_training_output_dir ).parent , "nnunet_checkpoint.pth" ),
186+ map_location = torch .device ("cpu" ),
187+ weights_only = True ,
186188 )
187189 trainer_name = checkpoint ["trainer_name" ]
188190 configuration_name = checkpoint ["init_args" ]["configuration" ]
@@ -192,7 +194,9 @@ def __init__(self, predictor: object, model_folder: Union[str, Path], model_name
192194 else None
193195 )
194196 if Path (model_training_output_dir ).joinpath (model_name ).is_file ():
195- monai_checkpoint = torch .load (join (model_training_output_dir , model_name ), map_location = torch .device ("cpu" ), weights_only = True )
197+ monai_checkpoint = torch .load (
198+ join (model_training_output_dir , model_name ), map_location = torch .device ("cpu" ), weights_only = True
199+ )
196200 if "network_weights" in monai_checkpoint .keys ():
197201 parameters .append (monai_checkpoint ["network_weights" ])
198202 else :
@@ -383,8 +387,12 @@ def convert_nnunet_to_monai_bundle(nnunet_config: dict, bundle_root_folder: str,
383387 dataset_name , f"{ nnunet_trainer } __{ nnunet_plans } __{ nnunet_configuration } "
384388 )
385389
386- nnunet_checkpoint_final = torch .load (Path (nnunet_model_folder ).joinpath (f"fold_{ fold } " , "checkpoint_final.pth" ), weights_only = True )
387- nnunet_checkpoint_best = torch .load (Path (nnunet_model_folder ).joinpath (f"fold_{ fold } " , "checkpoint_best.pth" ), weights_only = True )
390+ nnunet_checkpoint_final = torch .load (
391+ Path (nnunet_model_folder ).joinpath (f"fold_{ fold } " , "checkpoint_final.pth" ), weights_only = True
392+ )
393+ nnunet_checkpoint_best = torch .load (
394+ Path (nnunet_model_folder ).joinpath (f"fold_{ fold } " , "checkpoint_best.pth" ), weights_only = True
395+ )
388396
389397 nnunet_checkpoint = {}
390398 nnunet_checkpoint ["inference_allowed_mirroring_axes" ] = nnunet_checkpoint_final ["inference_allowed_mirroring_axes" ]
0 commit comments