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
72c6e8b8
Unverified
Commit
72c6e8b8
authored
Dec 15, 2021
by
Xing Han Lu
Committed by
GitHub
Dec 15, 2021
Browse files
Update t5.rst (#14776)
parent
a94105f9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
3 deletions
+1
-3
docs/source/model_doc/t5.rst
docs/source/model_doc/t5.rst
+1
-3
No files found.
docs/source/model_doc/t5.rst
View file @
72c6e8b8
...
...
@@ -191,10 +191,8 @@ language modeling head on top of the decoder.
labels = target_encoding.input_ids
# replace padding token id'
s
of
the
labels
by
-
100
labels
=
[
[(
label
if
label
!= tokenizer.pad_token_id else -100) for label in labels_example] for labels_example in labels
]
labels
=
torch
.
tensor
(
labels
)
labels
[
labels
==
tokenizer
.
pad_token_id
]
=
-
100
#
forward
pass
loss
=
model
(
input_ids
=
input_ids
,
attention_mask
=
attention_mask
,
labels
=
labels
).
loss
...
...
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