From d5196e14e2b5f1c09d2bc4e0f641bdad8ae9e58b Mon Sep 17 00:00:00 2001 From: Marwan Zouinkhi Date: Mon, 5 Aug 2024 17:05:32 -0400 Subject: [PATCH 1/3] fix new pytorch error --- dacapo/store/local_weights_store.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dacapo/store/local_weights_store.py b/dacapo/store/local_weights_store.py index fb375602b..a7ff3ca38 100644 --- a/dacapo/store/local_weights_store.py +++ b/dacapo/store/local_weights_store.py @@ -142,7 +142,7 @@ def retrieve_weights(self, run: str, iteration: int) -> Weights: weights_name = self.__get_weights_dir(run) / "iterations" / str(iteration) - weights: Weights = torch.load(weights_name, map_location="cpu") + weights: Weights = torch.load(weights_name, map_location="cpu", weights_only=True) if not isinstance(weights, Weights): # backwards compatibility weights = Weights(weights["model"], weights["optimizer"]) From 8d06bdbdb205f9b41bbe2be9df20f92592c713c3 Mon Sep 17 00:00:00 2001 From: Marwan Zouinkhi Date: Mon, 5 Aug 2024 17:15:41 -0400 Subject: [PATCH 2/3] fix new pytorch error --- dacapo/store/local_weights_store.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dacapo/store/local_weights_store.py b/dacapo/store/local_weights_store.py index a7ff3ca38..aea82fa94 100644 --- a/dacapo/store/local_weights_store.py +++ b/dacapo/store/local_weights_store.py @@ -142,7 +142,7 @@ def retrieve_weights(self, run: str, iteration: int) -> Weights: weights_name = self.__get_weights_dir(run) / "iterations" / str(iteration) - weights: Weights = torch.load(weights_name, map_location="cpu", weights_only=True) + weights: Weights = torch.load(weights_name, map_location="cpu", weights_only=False) if not isinstance(weights, Weights): # backwards compatibility weights = Weights(weights["model"], weights["optimizer"]) From b8567605cfd2897b7ed0f67ec123133effe4a319 Mon Sep 17 00:00:00 2001 From: mzouink Date: Mon, 5 Aug 2024 21:16:12 +0000 Subject: [PATCH 3/3] :art: Format Python code with psf/black --- dacapo/store/local_weights_store.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dacapo/store/local_weights_store.py b/dacapo/store/local_weights_store.py index aea82fa94..941906285 100644 --- a/dacapo/store/local_weights_store.py +++ b/dacapo/store/local_weights_store.py @@ -142,7 +142,9 @@ def retrieve_weights(self, run: str, iteration: int) -> Weights: weights_name = self.__get_weights_dir(run) / "iterations" / str(iteration) - weights: Weights = torch.load(weights_name, map_location="cpu", weights_only=False) + weights: Weights = torch.load( + weights_name, map_location="cpu", weights_only=False + ) if not isinstance(weights, Weights): # backwards compatibility weights = Weights(weights["model"], weights["optimizer"])