From 53459dfb82005e896e640c48b587b89f8ed975df Mon Sep 17 00:00:00 2001 From: Enoch Yu <71986194+YuEnoch@users.noreply.github.com> Date: Sat, 22 Mar 2025 23:41:49 -0400 Subject: [PATCH] Update train.py Echoing https://github.com/Project-MONAI/research-contributions/pull/413 Due to pytorch 2.6, it requires this update or else the script won't run Signed-off-by: Enoch Yu <71986194+YuEnoch@users.noreply.github.com> --- auto3dseg/algorithm_templates/swinunetr/scripts/train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto3dseg/algorithm_templates/swinunetr/scripts/train.py b/auto3dseg/algorithm_templates/swinunetr/scripts/train.py index cf66cfaa..88a2a1c0 100644 --- a/auto3dseg/algorithm_templates/swinunetr/scripts/train.py +++ b/auto3dseg/algorithm_templates/swinunetr/scripts/train.py @@ -340,7 +340,7 @@ def run(config_file: Optional[Union[str, Sequence[str]]] = None, **override): ) store_dict = model.state_dict() - model_dict = torch.load(pretrained_path, map_location=device, weights_only=True)["state_dict"] + model_dict = torch.load(pretrained_path, map_location=device, weights_only=False)["state_dict"] for key in model_dict.keys(): if "out" not in key: store_dict[key].copy_(model_dict[key])