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
6f0723a9
Unverified
Commit
6f0723a9
authored
Jul 01, 2022
by
Yih-Dar
Committed by
GitHub
Jul 01, 2022
Browse files
Restore original task in test_warning_logs (#17985)
Co-authored-by:
ydshieh
<
ydshieh@users.noreply.github.com
>
parent
009171d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
tests/pipelines/test_pipelines_common.py
tests/pipelines/test_pipelines_common.py
+11
-3
No files found.
tests/pipelines/test_pipelines_common.py
View file @
6f0723a9
...
...
@@ -777,9 +777,17 @@ class PipelineRegistryTest(unittest.TestCase):
logger_
=
transformers_logging
.
get_logger
(
"transformers.pipelines.base"
)
alias
=
"text-classification"
with
CaptureLogger
(
logger_
)
as
cm
:
PIPELINE_REGISTRY
.
register_pipeline
(
alias
,
{})
self
.
assertIn
(
f
"
{
alias
}
is already registered"
,
cm
.
out
)
# Get the original task, so we can restore it at the end.
# (otherwise the subsequential tests in `TextClassificationPipelineTests` will fail)
original_task
,
original_task_options
=
PIPELINE_REGISTRY
.
check_task
(
alias
)
try
:
with
CaptureLogger
(
logger_
)
as
cm
:
PIPELINE_REGISTRY
.
register_pipeline
(
alias
,
{})
self
.
assertIn
(
f
"
{
alias
}
is already registered"
,
cm
.
out
)
finally
:
# restore
PIPELINE_REGISTRY
.
register_pipeline
(
alias
,
original_task
)
@
require_torch
def
test_register_pipeline
(
self
):
...
...
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