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
f774b2e8
Unverified
Commit
f774b2e8
authored
Oct 22, 2020
by
Haebin Shin
Committed by
GitHub
Oct 22, 2020
Browse files
support relative path for best_model_checkpoint (#7973)
parent
83481056
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/trainer.py
src/transformers/trainer.py
+1
-1
No files found.
src/transformers/trainer.py
View file @
f774b2e8
...
@@ -1219,7 +1219,7 @@ class Trainer:
...
@@ -1219,7 +1219,7 @@ class Trainer:
checkpoints_sorted
=
[
checkpoint
[
1
]
for
checkpoint
in
checkpoints_sorted
]
checkpoints_sorted
=
[
checkpoint
[
1
]
for
checkpoint
in
checkpoints_sorted
]
# Make sure we don't delete the best model.
# Make sure we don't delete the best model.
if
self
.
state
.
best_model_checkpoint
is
not
None
:
if
self
.
state
.
best_model_checkpoint
is
not
None
:
best_model_index
=
checkpoints_sorted
.
index
(
self
.
state
.
best_model_checkpoint
)
best_model_index
=
checkpoints_sorted
.
index
(
str
(
Path
(
self
.
state
.
best_model_checkpoint
)
))
checkpoints_sorted
[
best_model_index
],
checkpoints_sorted
[
-
1
]
=
(
checkpoints_sorted
[
best_model_index
],
checkpoints_sorted
[
-
1
]
=
(
checkpoints_sorted
[
-
1
],
checkpoints_sorted
[
-
1
],
checkpoints_sorted
[
best_model_index
],
checkpoints_sorted
[
best_model_index
],
...
...
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