From 0692eb6b292a4df31d0d96def762ab2b2ef3382f Mon Sep 17 00:00:00 2001 From: Jong Wook Kim Date: Wed, 25 Jun 2025 17:51:51 -0700 Subject: [PATCH] Update __init__.py --- whisper/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/whisper/__init__.py b/whisper/__init__.py index ca918a9..f284ec0 100644 --- a/whisper/__init__.py +++ b/whisper/__init__.py @@ -147,10 +147,8 @@ def load_model( with ( io.BytesIO(checkpoint_file) if in_memory else open(checkpoint_file, "rb") ) as fp: - try: - checkpoint = torch.load(fp, map_location=device, weights_only=True) - except TypeError: # for compatibility with older torch - checkpoint = torch.load(fp, map_location=device) + kwargs = {"weights_only": True} if torch.__version__ >= "1.13" else {} + checkpoint = torch.load(fp, map_location=device, **kwargs) del checkpoint_file dims = ModelDimensions(**checkpoint["dims"])