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
1e45bef0
Unverified
Commit
1e45bef0
authored
Nov 23, 2020
by
Stas Bekman
Committed by
GitHub
Nov 23, 2020
Browse files
[trainer] make generate work with multigpu (#8716)
* make generate work with multigpu * better fix - thanks @sgugger
parent
90002427
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
9 deletions
+2
-9
examples/seq2seq/seq2seq_trainer.py
examples/seq2seq/seq2seq_trainer.py
+1
-1
examples/seq2seq/test_finetune_trainer.py
examples/seq2seq/test_finetune_trainer.py
+1
-8
No files found.
examples/seq2seq/seq2seq_trainer.py
View file @
1e45bef0
...
...
@@ -189,7 +189,7 @@ class Seq2SeqTrainer(Trainer):
}
if
self
.
args
.
predict_with_generate
and
not
self
.
args
.
prediction_loss_only
:
generated_tokens
=
model
.
generate
(
generated_tokens
=
self
.
model
.
generate
(
inputs
[
"input_ids"
],
attention_mask
=
inputs
[
"attention_mask"
],
**
gen_kwargs
,
...
...
examples/seq2seq/test_finetune_trainer.py
View file @
1e45bef0
...
...
@@ -4,13 +4,7 @@ from unittest.mock import patch
from
transformers
import
BertTokenizer
,
EncoderDecoderModel
from
transformers.file_utils
import
is_datasets_available
from
transformers.testing_utils
import
(
TestCasePlus
,
execute_subprocess_async
,
get_gpu_count
,
require_torch_non_multi_gpu_but_fix_me
,
slow
,
)
from
transformers.testing_utils
import
TestCasePlus
,
execute_subprocess_async
,
get_gpu_count
,
slow
from
transformers.trainer_callback
import
TrainerState
from
transformers.trainer_utils
import
set_seed
...
...
@@ -52,7 +46,6 @@ class TestFinetuneTrainer(TestCasePlus):
assert
"test_results.json"
in
contents
@
slow
@
require_torch_non_multi_gpu_but_fix_me
def
test_finetune_bert2bert
(
self
):
if
not
is_datasets_available
():
return
...
...
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