From c77a773ede15e4e7bd76dcea742a92a446990265 Mon Sep 17 00:00:00 2001 From: vviitani-amd Date: Wed, 7 May 2025 10:17:43 +0300 Subject: [PATCH 1/2] Make pt <= 2.5 default explicit --- fairseq/checkpoint_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fairseq/checkpoint_utils.py b/fairseq/checkpoint_utils.py index e3f316b9e7..aec99ff671 100644 --- a/fairseq/checkpoint_utils.py +++ b/fairseq/checkpoint_utils.py @@ -337,7 +337,7 @@ def load_checkpoint_to_cpu(path, arg_overrides=None, load_on_all_ranks=False): local_path = PathManager.get_local_path(path) with open(local_path, "rb") as f: - state = torch.load(f, map_location=torch.device("cpu")) + state = torch.load(f, map_location=torch.device("cpu"), wights_only=False) if "args" in state and state["args"] is not None and arg_overrides is not None: args = state["args"] @@ -911,6 +911,7 @@ def load_ema_from_checkpoint(fpath): map_location=( lambda s, _: torch.serialization.default_restore_location(s, "cpu") ), + weights_only=False, ) # EMA model is stored in a separate "extra state" From afe052f368499235f868962b9a901a66e389129e Mon Sep 17 00:00:00 2001 From: vviitani-amd Date: Wed, 7 May 2025 10:27:16 +0300 Subject: [PATCH 2/2] Typo --- fairseq/checkpoint_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fairseq/checkpoint_utils.py b/fairseq/checkpoint_utils.py index aec99ff671..8dd2c541a2 100644 --- a/fairseq/checkpoint_utils.py +++ b/fairseq/checkpoint_utils.py @@ -337,7 +337,7 @@ def load_checkpoint_to_cpu(path, arg_overrides=None, load_on_all_ranks=False): local_path = PathManager.get_local_path(path) with open(local_path, "rb") as f: - state = torch.load(f, map_location=torch.device("cpu"), wights_only=False) + state = torch.load(f, map_location=torch.device("cpu"), weights_only=False) if "args" in state and state["args"] is not None and arg_overrides is not None: args = state["args"]