Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
3994c045
Unverified
Commit
3994c045
authored
Dec 07, 2022
by
xloem
Committed by
GitHub
Dec 07, 2022
Browse files
Speed up git-lfs detection on error (#20641)
Prevent read and discard of entire checkpoint file.
parent
147fa37f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+1
-1
No files found.
src/transformers/modeling_utils.py
View file @
3994c045
...
@@ -415,7 +415,7 @@ def load_state_dict(checkpoint_file: Union[str, os.PathLike]):
...
@@ -415,7 +415,7 @@ def load_state_dict(checkpoint_file: Union[str, os.PathLike]):
except
Exception
as
e
:
except
Exception
as
e
:
try
:
try
:
with
open
(
checkpoint_file
)
as
f
:
with
open
(
checkpoint_file
)
as
f
:
if
f
.
read
(
).
startswith
(
"version"
)
:
if
f
.
read
(
7
)
==
"version"
:
raise
OSError
(
raise
OSError
(
"You seem to have cloned a repository without having git-lfs installed. Please install "
"You seem to have cloned a repository without having git-lfs installed. Please install "
"git-lfs and run `git lfs install` followed by `git lfs pull` in the folder "
"git-lfs and run `git lfs install` followed by `git lfs pull` in the folder "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment