huggingface
config_error
ai_generated
true
ValueError: The task `summarization_v2` is not supported by the pipeline. Supported tasks are: ['text-classification', 'token-classification', 'question-answering', 'summarization', 'translation', 'text-generation', 'zero-shot-classification', 'fill-mask', 'ner', 'sentiment-analysis']
ID: huggingface/pipeline-invalid-task
95%Fix Rate
88%Confidence
1Evidence
2023-03-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| transformers>=4.25.0 | active | — | — | — |
| huggingface-hub>=0.12.0 | active | — | — | — |
Root Cause
The pipeline API was called with a task identifier that does not match any registered pipeline task, often due to typos or using a non-standard task name.
generic中文
pipeline API 被调用时使用了未注册的任务标识符,通常是由于拼写错误或使用了非标准任务名称。
Official Documentation
https://huggingface.co/docs/transformers/en/main_classes/pipelines#transformers.pipeline.taskWorkarounds
-
95% success Correct the task name to a valid one: `from transformers import pipeline; pipe = pipeline('summarization', model='facebook/bart-large-cnn')`
Correct the task name to a valid one: `from transformers import pipeline; pipe = pipeline('summarization', model='facebook/bart-large-cnn')` -
90% success Use the model's default task by omitting the task argument: `pipe = pipeline(model='facebook/bart-large-cnn')` which auto-detects the task.
Use the model's default task by omitting the task argument: `pipe = pipeline(model='facebook/bart-large-cnn')` which auto-detects the task.
-
70% success If the task is truly custom, register it with `from transformers.pipelines import SUPPORTED_TASKS; SUPPORTED_TASKS['custom_task'] = {...}`
If the task is truly custom, register it with `from transformers.pipelines import SUPPORTED_TASKS; SUPPORTED_TASKS['custom_task'] = {...}`
中文步骤
Correct the task name to a valid one: `from transformers import pipeline; pipe = pipeline('summarization', model='facebook/bart-large-cnn')`Use the model's default task by omitting the task argument: `pipe = pipeline(model='facebook/bart-large-cnn')` which auto-detects the task.
If the task is truly custom, register it with `from transformers.pipelines import SUPPORTED_TASKS; SUPPORTED_TASKS['custom_task'] = {...}`
Dead Ends
Common approaches that don't work:
-
Installing an older version of transformers (e.g., 4.20.0) to bypass the error
80% fail
Older versions have even fewer supported tasks; the invalid task will still fail.
-
Creating a custom pipeline with the same name without registering it
90% fail
The pipeline registry is static; custom tasks must be registered via `PipelineRegistry` or by using a valid alias.
-
Changing the model name in the pipeline call
95% fail
The error is about the task argument, not the model; changing the model does not affect task validation.