torch.load without weights_only parameter is unsafe. Explicitly set weights_only to False only if you trust the data you load and full pickle functionality is needed, otherwise set weights_only=True.
gemma/model.py:562:13
--- /home/sdym/repos/google/gemma_pytorch/gemma/model.py
+++ /home/sdym/repos/google/gemma_pytorch/gemma/model.py
@@ -557,9 +557,9 @@
# If a string was provided as input, return a string as output.
return results[0] if is_str_prompt else results
def load_weights(self, model_path: str):
self.load_state_dict(
- torch.load(model_path, mmap=True)['model_state_dict'],
+ torch.load(model_path, mmap=True, weights_only=True)['model_state_dict'],
strict=False,
)
This is found via https://github.com/pytorch-labs/torchfix/
torch.load
withoutweights_only
parameter is unsafe. Explicitly setweights_only
to False only if you trust the data you load and full pickle functionality is needed, otherwise setweights_only=True
.gemma/model.py:562:13
gemma/model_xla.py:517:22