Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
1ecedf1d
Unverified
Commit
1ecedf1d
authored
Jul 25, 2024
by
Austin
Committed by
GitHub
Jul 25, 2024
Browse files
Update question_answering.py (#32208)
parent
f53a5dec
Changes
1
Show 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 @
1ecedf1d
...
@@ -118,7 +118,7 @@ def select_starts_ends(
...
@@ -118,7 +118,7 @@ def select_starts_ends(
max_answer_len (`int`): Maximum size of the answer to extract from the model's output.
max_answer_len (`int`): Maximum size of the answer to extract from the model's output.
"""
"""
# Ensure padded tokens & question tokens cannot belong to the set of candidate answers.
# Ensure padded tokens & question tokens cannot belong to the set of candidate answers.
undesired_tokens
=
np
.
abs
(
p_mask
.
numpy
(
)
-
1
)
undesired_tokens
=
np
.
abs
(
np
.
array
(
p_mask
)
-
1
)
if
attention_mask
is
not
None
:
if
attention_mask
is
not
None
:
undesired_tokens
=
undesired_tokens
&
attention_mask
undesired_tokens
=
undesired_tokens
&
attention_mask
...
...
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