Update __init__.py

This commit is contained in:
Jong Wook Kim 2025-06-25 17:45:54 -07:00 committed by GitHub
parent 8c3f996e1e
commit 915b3e747b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -147,7 +147,10 @@ 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)
del checkpoint_file
dims = ModelDimensions(**checkpoint["dims"])