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
a3aabc70
Unverified
Commit
a3aabc70
authored
Apr 29, 2024
by
Zach Mueller
Committed by
GitHub
Apr 29, 2024
Browse files
Include safetensors as part of `_load_best_model` (#30553)
* Include safetensors * Cleanup
parent
9df8b301
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/transformers/trainer.py
src/transformers/trainer.py
+3
-1
No files found.
src/transformers/trainer.py
View file @
a3aabc70
...
...
@@ -2611,7 +2611,9 @@ class Trainer:
load_result
=
model
.
load_state_dict
(
state_dict
,
False
)
if
not
is_sagemaker_mp_enabled
()
and
has_been_loaded
:
self
.
_issue_warnings_after_load
(
load_result
)
elif
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
state
.
best_model_checkpoint
,
WEIGHTS_INDEX_NAME
)):
elif
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
state
.
best_model_checkpoint
,
SAFE_WEIGHTS_INDEX_NAME
))
or
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
state
.
best_model_checkpoint
,
WEIGHTS_INDEX_NAME
)
):
load_result
=
load_sharded_checkpoint
(
model
,
self
.
state
.
best_model_checkpoint
,
strict
=
is_sagemaker_mp_enabled
()
)
...
...
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