Skip to content

Commit a7b0bfc

Browse files
committed
exception for unknown arg should have been TypeError
1 parent bd0f791 commit a7b0bfc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

timm/models/_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def load_pretrained(
185185
check_hash=_CHECK_HASH,
186186
weights_only=True,
187187
)
188-
except ValueError:
188+
except TypeError:
189189
state_dict = load_state_dict_from_url(
190190
pretrained_loc,
191191
map_location='cpu',

timm/models/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def load_state_dict(
5454
else:
5555
try:
5656
checkpoint = torch.load(checkpoint_path, map_location=device, weights_only=weights_only)
57-
except ValueError:
57+
except TypeError:
5858
checkpoint = torch.load(checkpoint_path, map_location=device)
5959

6060
state_dict_key = ''

timm/models/_hub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def load_state_dict_from_hf(
193193
_logger.debug(f"[{model_id}] Safe alternative not found for '{filename}'. Loading weights using default pytorch.")
194194
try:
195195
state_dict = torch.load(cached_file, map_location='cpu', weights_only=weights_only)
196-
except ValueError:
196+
except TypeError:
197197
state_dict = torch.load(cached_file, map_location='cpu')
198198
return state_dict
199199

0 commit comments

Comments
 (0)