mirror of
https://github.com/openai/whisper.git
synced 2025-11-23 22:15:58 +00:00
Fix: Update torch.load to use weights_only=True to prevent security w… (#2451)
* Fix: Update torch.load to use weights_only=True to prevent security warning * Update __init__.py * Update __init__.py --------- Co-authored-by: Jong Wook Kim <jongwook@openai.com>
This commit is contained in:
parent
679ae1d141
commit
1f8fc975d3
@ -147,7 +147,8 @@ def load_model(
|
|||||||
with (
|
with (
|
||||||
io.BytesIO(checkpoint_file) if in_memory else open(checkpoint_file, "rb")
|
io.BytesIO(checkpoint_file) if in_memory else open(checkpoint_file, "rb")
|
||||||
) as fp:
|
) as fp:
|
||||||
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
|
del checkpoint_file
|
||||||
|
|
||||||
dims = ModelDimensions(**checkpoint["dims"])
|
dims = ModelDimensions(**checkpoint["dims"])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user