Skip to content

Commit e76364d

Browse files
scottzh8Scott Zhang
andauthored
fix: improve visibility of ValueError root causes in model config loading (#41972)
* Make config util exception handling more informative when ValueError is raised * transform ValueError into OSError and propagate upstream instead --------- Co-authored-by: Scott Zhang <scottzh@fb.com>
1 parent 2b8068c commit e76364d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/transformers/utils/hub.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ def cached_files(
514514
"Check cache directory permissions. Common causes: 1) another user is downloading the same model (please wait); "
515515
"2) a previous download was canceled and the lock file needs manual removal."
516516
) from e
517+
elif isinstance(e, ValueError):
518+
raise OSError(f"{e}") from e
517519

518520
# Now we try to recover if we can find all files correctly in the cache
519521
resolved_files = [

0 commit comments

Comments
 (0)