diff --git a/whisper/__init__.py b/whisper/__init__.py index e679883..ca918a9 100644 --- a/whisper/__init__.py +++ b/whisper/__init__.py @@ -147,7 +147,10 @@ def load_model( with ( io.BytesIO(checkpoint_file) if in_memory else open(checkpoint_file, "rb") ) as fp: - checkpoint = torch.load(fp, map_location=device, weights_only=True) + 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) del checkpoint_file dims = ModelDimensions(**checkpoint["dims"])