Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
041fdc4a
Unverified
Commit
041fdc4a
authored
Feb 15, 2022
by
Patrick von Platen
Committed by
GitHub
Feb 15, 2022
Browse files
[SpeechEncoderDecoder] Make sure no EOS is generated in test (#15655)
parent
e314c19a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
tests/test_modeling_speech_encoder_decoder.py
tests/test_modeling_speech_encoder_decoder.py
+5
-0
No files found.
tests/test_modeling_speech_encoder_decoder.py
View file @
041fdc4a
...
@@ -308,6 +308,11 @@ class EncoderDecoderMixin:
...
@@ -308,6 +308,11 @@ class EncoderDecoderMixin:
enc_dec_model
=
SpeechEncoderDecoderModel
(
encoder
=
encoder_model
,
decoder
=
decoder_model
)
enc_dec_model
=
SpeechEncoderDecoderModel
(
encoder
=
encoder_model
,
decoder
=
decoder_model
)
enc_dec_model
.
to
(
torch_device
)
enc_dec_model
.
to
(
torch_device
)
# make sure EOS token is set to None to prevent early stopping of generation
enc_dec_model
.
config
.
eos_token_id
=
None
if
hasattr
(
enc_dec_model
.
config
,
"decoder"
)
and
hasattr
(
enc_dec_model
.
config
.
decoder
,
"eos_token_id"
):
enc_dec_model
.
config
.
decoder
.
eos_token_id
=
None
inputs
=
input_values
if
input_features
is
None
else
input_features
inputs
=
input_values
if
input_features
is
None
else
input_features
# Bert does not have a bos token id, so use pad_token_id instead
# Bert does not have a bos token id, so use pad_token_id instead
...
...
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