# ValueError: 任务 `summarization_v2` 不被 pipeline 支持。支持的任务有：['text-classification', 'token-classification', 'question-answering', 'summarization', 'translation', 'text-generation', 'zero-shot-classification', 'fill-mask', 'ner', 'sentiment-analysis']

- **ID:** `huggingface/pipeline-invalid-task`
- **领域:** huggingface
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 95%

## 根因

pipeline API 被调用时使用了未注册的任务标识符，通常是由于拼写错误或使用了非标准任务名称。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| transformers>=4.25.0 | active | — | — |
| huggingface-hub>=0.12.0 | active | — | — |

## 解决方案

1. ```
   Correct the task name to a valid one: `from transformers import pipeline; pipe = pipeline('summarization', model='facebook/bart-large-cnn')`
   ```
2. ```
   Use the model's default task by omitting the task argument: `pipe = pipeline(model='facebook/bart-large-cnn')` which auto-detects the task.
   ```
3. ```
   If the task is truly custom, register it with `from transformers.pipelines import SUPPORTED_TASKS; SUPPORTED_TASKS['custom_task'] = {...}`
   ```

## 无效尝试

- **Installing an older version of transformers (e.g., 4.20.0) to bypass the error** — Older versions have even fewer supported tasks; the invalid task will still fail. (80% 失败率)
- **Creating a custom pipeline with the same name without registering it** — The pipeline registry is static; custom tasks must be registered via `PipelineRegistry` or by using a valid alias. (90% 失败率)
- **Changing the model name in the pipeline call** — The error is about the task argument, not the model; changing the model does not affect task validation. (95% 失败率)
