mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 06:26:03 +00:00
Update __init__.py
This commit is contained in:
parent
915b3e747b
commit
0692eb6b29
@ -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"])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user