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
8fcb6935
Unverified
Commit
8fcb6935
authored
Nov 18, 2020
by
Sylvain Gugger
Committed by
GitHub
Nov 18, 2020
Browse files
Fix DataCollatorForLanguageModeling (#8621)
parent
f6fe41c9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/data/data_collator.py
src/transformers/data/data_collator.py
+1
-1
No files found.
src/transformers/data/data_collator.py
View file @
8fcb6935
...
...
@@ -261,7 +261,7 @@ class DataCollatorForLanguageModeling:
batch
[
"input_ids"
],
special_tokens_mask
=
special_tokens_mask
)
else
:
labels
=
batch
[
"input_ids"
]
labels
=
batch
[
"input_ids"
]
.
clone
()
if
self
.
tokenizer
.
pad_token_id
is
not
None
:
labels
[
labels
==
self
.
tokenizer
.
pad_token_id
]
=
-
100
batch
[
"labels"
]
=
labels
...
...
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