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
f284aa32
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "d5de578c2227250d615f73a8fb88a5ce7f1743be"
Unverified
Commit
f284aa32
authored
Mar 14, 2022
by
Merve Noyan
Committed by
GitHub
Mar 14, 2022
Browse files
steps strategy fix for PushtoHubCallback (#16138)
parent
e3645fd2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/keras_callbacks.py
src/transformers/keras_callbacks.py
+2
-2
No files found.
src/transformers/keras_callbacks.py
View file @
f284aa32
...
@@ -264,7 +264,7 @@ class PushToHubCallback(Callback):
...
@@ -264,7 +264,7 @@ class PushToHubCallback(Callback):
save_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"epoch"`):
save_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"epoch"`):
The checkpoint save strategy to adopt during training. Possible values are:
The checkpoint save strategy to adopt during training. Possible values are:
- `"no"`:
No s
ave is done
during
training.
- `"no"`:
S
ave is done
at the end of
training.
- `"epoch"`: Save is done at the end of each epoch.
- `"epoch"`: Save is done at the end of each epoch.
- `"steps"`: Save is done every `save_steps`
- `"steps"`: Save is done every `save_steps`
save_steps (`int`, *optional*):
save_steps (`int`, *optional*):
...
@@ -331,7 +331,7 @@ class PushToHubCallback(Callback):
...
@@ -331,7 +331,7 @@ class PushToHubCallback(Callback):
self
.
training_history
=
[]
self
.
training_history
=
[]
def
on_train_batch_end
(
self
,
batch
,
logs
=
None
):
def
on_train_batch_end
(
self
,
batch
,
logs
=
None
):
if
self
.
save_strategy
==
IntervalStrategy
.
STEPS
and
batch
+
1
%
self
.
save_steps
==
0
:
if
self
.
save_strategy
==
IntervalStrategy
.
STEPS
and
(
batch
+
1
)
%
self
.
save_steps
==
0
:
if
self
.
last_job
is
not
None
and
not
self
.
last_job
.
is_done
:
if
self
.
last_job
is
not
None
and
not
self
.
last_job
.
is_done
:
return
# The last upload is still running, don't start another
return
# The last upload is still running, don't start another
self
.
model
.
save_pretrained
(
self
.
output_dir
)
self
.
model
.
save_pretrained
(
self
.
output_dir
)
...
...
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