From 5546198482a6e4bd85667655b8caaf381b90f75a Mon Sep 17 00:00:00 2001 From: FlyingFathead Date: Mon, 23 Sep 2024 19:15:15 +0300 Subject: [PATCH] Fix unsafe `torch.load` by adding `weights_only=True` --- resemblyzer/voice_encoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resemblyzer/voice_encoder.py b/resemblyzer/voice_encoder.py index d6306f0..eddc230 100644 --- a/resemblyzer/voice_encoder.py +++ b/resemblyzer/voice_encoder.py @@ -40,7 +40,7 @@ def __init__(self, device: Union[str, torch.device]=None, verbose=True, weights_ raise Exception("Couldn't find the voice encoder pretrained model at %s." % weights_fpath) start = timer() - checkpoint = torch.load(weights_fpath, map_location="cpu") + checkpoint = torch.load(weights_fpath, map_location="cpu", weights_only=True) self.load_state_dict(checkpoint["model_state"], strict=False) self.to(device)