mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
exception for unknown arg should have been TypeError
This commit is contained in:
parent
bd0f79153b
commit
a7b0bfc376
@ -185,7 +185,7 @@ def load_pretrained(
|
||||
check_hash=_CHECK_HASH,
|
||||
weights_only=True,
|
||||
)
|
||||
except ValueError:
|
||||
except TypeError:
|
||||
state_dict = load_state_dict_from_url(
|
||||
pretrained_loc,
|
||||
map_location='cpu',
|
||||
|
@ -54,7 +54,7 @@ def load_state_dict(
|
||||
else:
|
||||
try:
|
||||
checkpoint = torch.load(checkpoint_path, map_location=device, weights_only=weights_only)
|
||||
except ValueError:
|
||||
except TypeError:
|
||||
checkpoint = torch.load(checkpoint_path, map_location=device)
|
||||
|
||||
state_dict_key = ''
|
||||
|
@ -193,7 +193,7 @@ def load_state_dict_from_hf(
|
||||
_logger.debug(f"[{model_id}] Safe alternative not found for '{filename}'. Loading weights using default pytorch.")
|
||||
try:
|
||||
state_dict = torch.load(cached_file, map_location='cpu', weights_only=weights_only)
|
||||
except ValueError:
|
||||
except TypeError:
|
||||
state_dict = torch.load(cached_file, map_location='cpu')
|
||||
return state_dict
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user