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
2eb596f0
Unverified
Commit
2eb596f0
authored
Mar 23, 2021
by
Marta Maślankowska
Committed by
GitHub
Mar 23, 2021
Browse files
Fix p_mask cls token masking in qa pipeline (#10863)
parent
eb330e89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/pipelines/question_answering.py
src/transformers/pipelines/question_answering.py
+1
-1
No files found.
src/transformers/pipelines/question_answering.py
View file @
2eb596f0
...
...
@@ -268,7 +268,7 @@ class QuestionAnsweringPipeline(Pipeline):
)
# keep the cls_token unmasked (some models use it to indicate unanswerable questions)
if
self
.
tokenizer
.
cls_token_id
:
if
self
.
tokenizer
.
cls_token_id
is
not
None
:
cls_index
=
np
.
nonzero
(
encoded_inputs
[
"input_ids"
]
==
self
.
tokenizer
.
cls_token_id
)
p_mask
[
cls_index
]
=
0
...
...
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