Skip to content

Commit 9d294cd

Browse files
authored
Merge pull request #2510 from emmanuel-ferdman/main
Throw exception on non-directory path for pretrained weights
2 parents 6a621b5 + 3f543f1 commit 9d294cd

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)