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
7d4fe85e
Unverified
Commit
7d4fe85e
authored
May 25, 2023
by
Sylvain Gugger
Committed by
GitHub
May 25, 2023
Browse files
Fix psuh_to_hub in Trainer when nothing needs pushing (#23751)
parent
06c28cd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
src/transformers/trainer.py
src/transformers/trainer.py
+4
-3
No files found.
src/transformers/trainer.py
View file @
7d4fe85e
...
@@ -3699,9 +3699,10 @@ class Trainer:
...
@@ -3699,9 +3699,10 @@ class Trainer:
commit_message
=
f
"Training in progress, step
{
self
.
state
.
global_step
}
"
commit_message
=
f
"Training in progress, step
{
self
.
state
.
global_step
}
"
else
:
else
:
commit_message
=
f
"Training in progress, epoch
{
int
(
self
.
state
.
epoch
)
}
"
commit_message
=
f
"Training in progress, epoch
{
int
(
self
.
state
.
epoch
)
}
"
_
,
self
.
push_in_progress
=
self
.
repo
.
push_to_hub
(
push_work
=
self
.
repo
.
push_to_hub
(
commit_message
=
commit_message
,
blocking
=
False
,
auto_lfs_prune
=
True
)
commit_message
=
commit_message
,
blocking
=
False
,
auto_lfs_prune
=
True
# Return type of `Repository.push_to_hub` is either None or a tuple.
)
if
push_work
is
not
None
:
self
.
push_in_progress
=
push_work
[
1
]
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
f
"Error when pushing to hub:
{
e
}
"
)
logger
.
error
(
f
"Error when pushing to hub:
{
e
}
"
)
finally
:
finally
:
...
...
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