# ValueError：此任务不支持分块推理。设置 `chunked_inference=False` 或使用兼容的任务，如 'text-generation'。

- **ID:** `huggingface/pipeline-task-chunked-inference-error`
- **领域:** huggingface
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

用户尝试在不受支持的分块推理任务（如 'text-classification'）上启用 `chunked_inference=True`，因为该任务期望每个分块输出不重叠。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| transformers 4.45.0 | active | — | — |

## 解决方案

1. ```
   Set `chunked_inference=False` explicitly: `pipe = pipeline('text-classification', model='model-name', chunked_inference=False)`.
   ```
2. ```
   Manually implement chunking by splitting input text into batches and calling the pipeline in a loop without the `chunked_inference` parameter.
   ```

## 无效尝试

- **** — The error is raised before any inference; try-except cannot bypass the validation check. (100% 失败率)
- **** — This is actually a valid workaround but not a direct fix for the parameter; the user might think setting `chunked_inference=True` is equivalent, but it's not. (20% 失败率)
