# Issue with summarization and translation pipeline

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fissue-with-summarization-and-translation-pipeline%2F173919%3E%5C
**Category:** 🤗Transformers\
**Created:** [March 1, 2026, 11:26am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fissue-with-summarization-and-translation-pipeline%2F173919 "2026-03-01T11:26:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuvrajsharma000](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/yuvrajsharma000/32/58293_2.png) [@yuvrajsharma000](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fyuvrajsharma000)%5C
**Post date:** [March 1, 2026, 11:26am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fissue-with-summarization-and-translation-pipeline%2F173919%2F1 "2026-03-01T11:26:50Z")

</div>

1. summarization as a task in pipeline object is not available.  

2. Similar issue for translation pipeline

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [March 1, 2026, 11:26am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fissue-with-summarization-and-translation-pipeline%2F173919%2F2 "2026-03-01T11:26:51Z")

</div>

Unlisted on March 1, 2026, 11:26am UTC



---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [March 2, 2026, 12:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fissue-with-summarization-and-translation-pipeline%2F173919%2F3 "2026-03-02T00:16:05Z")

</div>

Listed on March 2, 2026, 12:16am UTC



---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [March 2, 2026, 4:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fissue-with-summarization-and-translation-pipeline%2F173919%2F4 "2026-03-02T04:27:51Z")

</div>

This is because [several pipelines were removed in the upgrade from Transformers v4 to v5](https://github.com/huggingface/transformers/blob/main/MIGRATION_GUIDE_V5.md).

* * *

## Why `pipeline("summarization")` and translation pipelines fail

### 1) In Transformers **v5.x** , those pipeline tasks were **removed**

Transformers **v5** removed the legacy text-to-text pipelines:

- `Text2TextGenerationPipeline`
- and the related `SummarizationPipeline` / `TranslationPipeline`

The migration guide states these were deprecated and are now removed, recommending modern chat models via `TextGenerationPipeline` instead. ([GitHub](https://raw.githubusercontent.com/huggingface/transformers/main/MIGRATION_GUIDE_V5.md "raw.githubusercontent.com"))

### 2) `pipeline()` only accepts tasks that are **registered**

`pipeline("…")` doesn’t “infer” what you mean; it checks a registry (`SUPPORTED_TASKS`). In **v5.2.0** , the list of accepted tasks includes things like `text-generation`, `question-answering`, etc., but **does not include** `summarization` or `translation`. ([GitHub](https://raw.githubusercontent.com/huggingface/transformers/v5.2.0/src/transformers/pipelines/ __init__.py "raw.githubusercontent.com"))

So:

- `pipeline("summarization")` → **Unknown task / task not available**
- `pipeline("translation…")` → similarly fails (because the pipeline task is not registered)

### 3) It’s confusing because older docs/tutorials still show the old pattern

There’s an open issue noting that the summarization/translation docs still referenced `pipeline()` examples, which misleads users on v5. ([GitHub](https://github.com/huggingface/transformers/issues/43827 "Summarization/Translation docs still reference pipeline() after v5 pipeline removals · Issue #43827 · huggingface/transformers · GitHub"))

### 4) Translation errors can be misleading

There’s also a reported bug where the error message suggests `translation_XX_to_YY` tasks are available, but they still fail because `"translation"` isn’t actually supported in v5’s pipeline registry. ([GitHub](https://github.com/huggingface/transformers/issues/43825 "pipeline() error message incorrectly suggests translation tasks are supported in v5 · Issue #43825 · huggingface/transformers · GitHub"))

### 5) This is not just you—downstream libraries broke too

For example, MLflow users reported breakage because `TranslationPipeline` / `SummarizationPipeline` classes no longer exist in v5. ([GitHub](https://github.com/mlflow/mlflow/issues/20604 "[FR] Add support for transformers 5.x (TranslationPipeline, SummarizationPipeline removed) · Issue #20604 · mlflow/mlflow · GitHub"))

* * *

## Quick confirmation (recommended first)

Run this to confirm you’re on v5 and see what pipeline tasks exist:

```python
import transformers
from transformers.pipelines import get_supported_tasks

print(transformers. __version__ )
print(get_supported_tasks())

```

If the printed task list doesn’t include `summarization` / `translation`, you’re in the v5 behavior described above. ([GitHub](https://raw.githubusercontent.com/huggingface/transformers/v5.2.0/src/transformers/pipelines/ __init__.py "raw.githubusercontent.com"))

* * *

## Solutions (choose one)

## Option A — Keep the old pipeline API (pin to v4)

If you want `pipeline("summarization")` and `pipeline("translation_xx_to_yy")` to work as in older tutorials, install Transformers v4:

```bash
pip install -U "transformers<5"

```

Why this works: v4 pipeline docs explicitly describe summarization and `translation_xx_to_yy` pipeline tasks as supported. ([Hugging Face](https://huggingface.co/docs/transformers/v4.57.1/zh/main_classes/pipelines "Pipelines"))

Use this option if:

- you’re following older notebooks/courses
- you want the classic pipeline outputs (`{"summary_text": ...}`, `{"translation_text": ...}`)

* * *

## Option B — Stay on v5 and use **seq2seq models via `generate()`**

Even though the convenience pipelines are gone, **seq2seq models still work** (e.g., BART/T5/Marian/NLLB). You just call `model.generate()` yourself.

The official generation docs recommend `max_new_tokens` to control output length. ([Hugging Face](https://huggingface.co/docs/transformers/en/main_classes/text_generation "Generation"))

### Summarization example (BART)

```python
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

model_id = "facebook/bart-large-cnn"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)

device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device).eval()

text = "YOUR ARTICLE HERE"
inputs = tok(text, return_tensors="pt", truncation=True).to(device)

with torch.inference_mode():
    out = model.generate(
        **inputs,
        max_new_tokens=150, # recommended way to control output length
        num_beams=4,
        no_repeat_ngram_size=3,
    )

summary = tok.decode(out[0], skip_special_tokens=True)
print(summary)

```

### Translation example (Marian)

```python
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

model_id = "Helsinki-NLP/opus-mt-en-ja"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)

device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device).eval()

text = "Hello, how are you?"
inputs = tok(text, return_tensors="pt", truncation=True).to(device)

with torch.inference_mode():
    out = model.generate(**inputs, max_new_tokens=128)

print(tok.decode(out[0], skip_special_tokens=True))

```

### Important translation pitfall (multilingual models)

If you use models like **NLLB** or **M2M100** , you typically must force the target language token using `forced_bos_token_id`. ([Hugging Face](https://huggingface.co/docs/transformers/v4.41.1/model_doc/nllb "NLLB - Transformers"))

* * *

## Option C — Follow the v5 recommendation: use `pipeline("text-generation")` with a chat model

Transformers v5’s migration guide explicitly recommends using `TextGenerationPipeline` with a modern chat model for summarization/translation via prompting. ([GitHub](https://raw.githubusercontent.com/huggingface/transformers/main/MIGRATION_GUIDE_V5.md "raw.githubusercontent.com"))

### Summarization via chat model

```python
from transformers import pipeline

summarizer = pipeline("text-generation", model="Qwen/Qwen3-4B-Instruct-2507")
messages = [{"role": "user", "content": "Summarize the following text:\n\n[TEXT]"}]

out = summarizer(messages)
print(out[0]["generated_text"][-1]["content"])

```

### Translation via chat model

Same idea; change the prompt:

```python
from transformers import pipeline

translator = pipeline("text-generation", model="Qwen/Qwen3-4B-Instruct-2507")
messages = [{"role": "user", "content": "Translate this into Japanese:\n\nHello, how are you?"}]

out = translator(messages)
print(out[0]["generated_text"][-1]["content"])

```

Use this option if:

- you want better “instruction-following” behavior without model-family-specific translation settings
- you prefer staying inside the pipeline API (but using `text-generation`)

* * *

## What I would pick (rule of thumb)

- Want **old tutorials to work unchanged** → **Option A** (`transformers<5`)
- Want **deterministic seq2seq translation/summarization** with classic models → **Option B** (`generate()`)
- Want **highest convenience** and often better quality via instruction prompts → **Option C** (`pipeline("text-generation")`)
