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
3cac867f
Unverified
Commit
3cac867f
authored
Aug 28, 2020
by
Sam Shleifer
Committed by
GitHub
Aug 28, 2020
Browse files
t5 model should make decoder_attention_mask (#6800)
parent
20f77864
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
3 deletions
+0
-3
src/transformers/tokenization_t5.py
src/transformers/tokenization_t5.py
+0
-1
tests/test_tokenization_t5.py
tests/test_tokenization_t5.py
+0
-2
No files found.
src/transformers/tokenization_t5.py
View file @
3cac867f
...
...
@@ -372,6 +372,5 @@ class T5Tokenizer(PreTrainedTokenizer):
**
kwargs
,
)
model_inputs
[
"labels"
]
=
labels_and_decoder_mask
[
"input_ids"
]
model_inputs
[
"decoder_attention_mask"
]
=
labels_and_decoder_mask
[
"attention_mask"
]
self
.
prefix_tokens
=
[]
return
model_inputs
tests/test_tokenization_t5.py
View file @
3cac867f
...
...
@@ -162,14 +162,12 @@ class T5TokenizationTest(TokenizerTesterMixin, unittest.TestCase):
src_text
,
tgt_texts
=
tgt_text
,
max_target_length
=
32
,
padding
=
"max_length"
,
return_tensors
=
FRAMEWORK
)
self
.
assertEqual
(
32
,
batch
[
"labels"
].
shape
[
1
])
self
.
assertEqual
(
32
,
batch
[
"decoder_attention_mask"
].
shape
[
1
])
# test None max_target_length
batch
=
tokenizer
.
prepare_seq2seq_batch
(
src_text
,
tgt_texts
=
tgt_text
,
max_length
=
32
,
padding
=
"max_length"
,
return_tensors
=
FRAMEWORK
)
self
.
assertEqual
(
32
,
batch
[
"labels"
].
shape
[
1
])
self
.
assertEqual
(
32
,
batch
[
"decoder_attention_mask"
].
shape
[
1
])
def
test_outputs_not_longer_than_maxlen
(
self
):
tokenizer
=
self
.
t5_base_tokenizer
...
...
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