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
1e2acd0d
Unverified
Commit
1e2acd0d
authored
Nov 09, 2020
by
Shashank Gupta
Committed by
GitHub
Nov 09, 2020
Browse files
Bug fix for permutation language modelling (#8409)
parent
bf8625e7
Changes
1
Hide 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 @
1e2acd0d
...
@@ -579,7 +579,7 @@ class DataCollatorForPermutationLanguageModeling:
...
@@ -579,7 +579,7 @@ class DataCollatorForPermutationLanguageModeling:
masked_indices
.
masked_fill_
(
padding_mask
,
value
=
0.0
)
masked_indices
.
masked_fill_
(
padding_mask
,
value
=
0.0
)
# Mask indicating non-functional tokens, where functional tokens are [SEP], [CLS], padding, etc.
# Mask indicating non-functional tokens, where functional tokens are [SEP], [CLS], padding, etc.
non_func_mask
=
~
(
padding_mask
&
special_tokens_mask
)
non_func_mask
=
~
(
padding_mask
|
special_tokens_mask
)
inputs
[
masked_indices
]
=
self
.
tokenizer
.
mask_token_id
inputs
[
masked_indices
]
=
self
.
tokenizer
.
mask_token_id
labels
[
~
masked_indices
]
=
-
100
# We only compute loss on masked tokens
labels
[
~
masked_indices
]
=
-
100
# We only compute loss on masked tokens
...
...
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