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
aceb3fba
Commit
aceb3fba
authored
Mar 05, 2020
by
Patrick von Platen
Browse files
only do output_past=True for language generation in bart
parent
7cba11fb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
tests/test_modeling_bart.py
tests/test_modeling_bart.py
+0
-2
tests/test_modeling_common.py
tests/test_modeling_common.py
+3
-0
No files found.
tests/test_modeling_bart.py
View file @
aceb3fba
...
...
@@ -64,7 +64,6 @@ class ModelTester:
self
.
eos_token_id
=
2
self
.
pad_token_id
=
1
self
.
bos_token_id
=
0
self
.
output_past
=
True
torch
.
manual_seed
(
0
)
def
prepare_config_and_inputs_for_common
(
self
):
...
...
@@ -86,7 +85,6 @@ class ModelTester:
eos_token_ids
=
self
.
eos_token_id
,
bos_token_id
=
self
.
bos_token_id
,
pad_token_id
=
self
.
pad_token_id
,
output_past
=
self
.
output_past
,
)
inputs_dict
=
prepare_bart_inputs_dict
(
config
,
input_ids
)
return
config
,
inputs_dict
...
...
tests/test_modeling_common.py
View file @
aceb3fba
...
...
@@ -628,6 +628,9 @@ class ModelTesterMixin:
"input_ids"
,
None
)
# TODO (PVP): ugly workaround to make code work for t5 for the moment - has to changed when t5 is fixed.
if
self
.
is_encoder_decoder
:
config
.
output_past
=
True
# needed for Bart TODO: might have to update for other encoder-decoder models
for
model_class
in
self
.
all_generative_model_classes
:
model
=
model_class
(
config
)
model
.
to
(
torch_device
)
...
...
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