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
85788bae
Commit
85788bae
authored
Jan 15, 2021
by
Kiyoung Kim
Committed by
Lysandre
Jan 15, 2021
Browse files
Revert "Gradient accumulation for TFTrainer (#9585)"
This reverts commit
3f40070c
.
parent
82498cbc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
src/transformers/trainer_tf.py
src/transformers/trainer_tf.py
+4
-10
No files found.
src/transformers/trainer_tf.py
View file @
85788bae
...
...
@@ -638,9 +638,7 @@ class TFTrainer:
reduced_features
=
{
k
:
ft
[:
self
.
args
.
train_batch_size
//
self
.
args
.
n_replicas
]
for
k
,
ft
in
features
.
items
()
}
reduced_labels
=
{
k
:
lbl
[:
self
.
args
.
train_batch_size
//
self
.
args
.
n_replicas
]
for
k
,
lbl
in
labels
.
items
()
}
reduced_labels
=
labels
[:
self
.
args
.
train_batch_size
//
self
.
args
.
n_replicas
]
self
.
training_step
(
reduced_features
,
reduced_labels
,
nb_instances_in_global_batch
)
...
...
@@ -652,13 +650,9 @@ class TFTrainer:
for
k
,
ft
in
features
.
items
()
}
labels
=
{
k
:
tf
.
concat
(
[
lbl
[
self
.
args
.
train_batch_size
//
self
.
args
.
n_replicas
:],
reduced_labels
[
k
]],
axis
=
0
,
labels
=
tf
.
concat
(
[
labels
[
self
.
args
.
train_batch_size
//
self
.
args
.
n_replicas
:],
reduced_labels
],
axis
=
0
)
for
k
,
lbl
in
labels
.
items
()
}
gradients
=
self
.
gradient_accumulator
.
gradients
gradients
=
[
...
...
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