Skip to content

Commit 3f543f1

Browse files
Throw exception on non-directory path for pretrained weights
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
1 parent 6a621b5 commit 3f543f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

timm/models/_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def load_pretrained(
220220
if pretrained_path.is_dir():
221221
state_dict = load_state_dict_from_path(pretrained_path)
222222
else:
223-
RuntimeError(f"Specified path is not a directory: {pretrained_loc}")
223+
raise RuntimeError(f"Specified path is not a directory: {pretrained_loc}")
224224
else:
225225
model_name = pretrained_cfg.get('architecture', 'this model')
226226
raise RuntimeError(f"No pretrained weights exist for {model_name}. Use `pretrained=False` for random init.")

0 commit comments

Comments
 (0)