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
2b282296
Unverified
Commit
2b282296
authored
May 19, 2022
by
Nicolas Patry
Committed by
GitHub
May 19, 2022
Browse files
Adding `batch_size` test to QA pipeline. (#17330)
parent
a4386d7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
tests/pipelines/test_pipelines_question_answering.py
tests/pipelines/test_pipelines_question_answering.py
+7
-0
No files found.
tests/pipelines/test_pipelines_question_answering.py
View file @
2b282296
...
@@ -106,6 +106,13 @@ class QAPipelineTests(unittest.TestCase, metaclass=PipelineTestCaseMeta):
...
@@ -106,6 +106,13 @@ class QAPipelineTests(unittest.TestCase, metaclass=PipelineTestCaseMeta):
)
)
self
.
assertEqual
(
outputs
,
{
"answer"
:
ANY
(
str
),
"start"
:
ANY
(
int
),
"end"
:
ANY
(
int
),
"score"
:
ANY
(
float
)})
self
.
assertEqual
(
outputs
,
{
"answer"
:
ANY
(
str
),
"start"
:
ANY
(
int
),
"end"
:
ANY
(
int
),
"score"
:
ANY
(
float
)})
# Using batch is OK
new_outputs
=
question_answerer
(
question
=
"Where was HuggingFace founded ?"
,
context
=
"HuggingFace was founded in Paris."
*
20
,
batch_size
=
2
)
self
.
assertEqual
(
new_outputs
,
{
"answer"
:
ANY
(
str
),
"start"
:
ANY
(
int
),
"end"
:
ANY
(
int
),
"score"
:
ANY
(
float
)})
self
.
assertEqual
(
outputs
,
new_outputs
)
@
require_torch
@
require_torch
def
test_small_model_pt
(
self
):
def
test_small_model_pt
(
self
):
question_answerer
=
pipeline
(
question_answerer
=
pipeline
(
...
...
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