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
8d1d1ffd
".github/vscode:/vscode.git/clone" did not exist on "025425f2603b109e2c6d5f803caaea45b8724fef"
Commit
8d1d1ffd
authored
Mar 25, 2019
by
Matthew Carrigan
Browse files
Corrected the displayed loss when gradient_accumulation_steps > 1
parent
abb7d1ff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/lm_finetuning/finetune_on_pregenerated.py
examples/lm_finetuning/finetune_on_pregenerated.py
+1
-1
No files found.
examples/lm_finetuning/finetune_on_pregenerated.py
View file @
8d1d1ffd
...
...
@@ -309,7 +309,7 @@ def main():
nb_tr_examples
+=
input_ids
.
size
(
0
)
nb_tr_steps
+=
1
pbar
.
update
(
1
)
mean_loss
=
tr_loss
/
nb_tr_steps
mean_loss
=
tr_loss
*
args
.
gradient_accumulation_steps
/
nb_tr_steps
pbar
.
set_postfix_str
(
f
"Loss:
{
mean_loss
:.
5
f
}
"
)
if
(
step
+
1
)
%
args
.
gradient_accumulation_steps
==
0
:
if
args
.
fp16
:
...
...
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