summarization pipeline breaks.
Author: jiqing-feng
Pull request: no
Labels: name: bug

### System Info

 #41996

### Who can help?

@Rocketknight1 

### Information

- [x] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

Official script from https://huggingface.co/facebook/bart-large-cnn 

```
from transformers import pipeline

summarizer = pipeline("summarization", model="facebook/bart-large-cnn")

ARTICLE = """ New York (CNN)When Liana Barrientos was 23 years old, she got married in Westchester County, New York.
A year later, she got married again in Westchester County, but to a different man and without divorcing her first husband.
Only 18 days after that marriage, she got hitched yet again. Then, Barrientos declared "I do" five more times, sometimes only within two weeks of each other.
In 2010, she married once more, this time in the Bronx. In an application for a marriage license, she stated it was her "first and only" marriage.
Barrientos, now 39, is facing two criminal counts of "offering a false instrument for filing in the first degree," referring to her false statements on the
2010 marriage license application, according to court documents.
Prosecutors said the marriages were part of an immigration scam.
On Friday, she pleaded not guilty at State Supreme Court in the Bronx, according to her attorney, Christopher Wright, who declined to comment further.
After leaving court, Barrientos was arrested and charged with theft of service and criminal trespass for allegedly sneaking into the New York subway through an emergency exit, said Detective
Annette Markowski, a police spokeswoman. In total, Barrientos has been married 10 times, with nine of her marriages occurring between 1999 and 2002.
All occurred either in Westchester County, Long Island, New Jersey or the Bronx. She is believed to still be married to four men, and at one time, she was married to eight men at once, prosecutors say.
Prosecutors said the immigration scam involved some of her husbands, who filed for permanent residence status shortly after the marriages.
Any divorces happened only after such filings were approved. It was unclear whether any of the men will be prosecuted.
The case was referred to the Bronx District Attorney\'s Office by Immigration and Customs Enforcement and the Department of Homeland Security\'s
Investigation Division. Seven of the men are from so-called "red-flagged" countries, including Egypt, Turkey, Georgia, Pakistan and Mali.
Her eighth husband, Rashid Rajput, was deported in 2006 to his native Pakistan after an investigation by the Joint Terrorism Task Force.
If convicted, Barrientos faces up to four years in prison.  Her next court appearance is scheduled for May 18.
"""
print(summarizer(ARTICLE, max_length=130, min_length=30, do_sample=False))
```


output:
```
Traceback (most recent call last):
  File "/home/jiqingfe/HuggingFace/tests/workloads/test_summ.py", line 23, in <module>
    print(summarizer(ARTICLE, max_length=130, min_length=30, do_sample=False))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqingfe/transformers/src/transformers/pipelines/deprecated/text2text_generation.py", line 295, in __call__
    return super().__call__(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqingfe/transformers/src/transformers/pipelines/deprecated/text2text_generation.py", line 188, in __call__
    result = super().__call__(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqingfe/transformers/src/transformers/pipelines/base.py", line 1278, in __call__
    return self.run_single(inputs, preprocess_params, forward_params, postprocess_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqingfe/transformers/src/transformers/pipelines/base.py", line 1285, in run_single
    model_outputs = self.forward(model_inputs, **forward_params)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqingfe/transformers/src/transformers/pipelines/base.py", line 1177, in forward
    model_outputs = self._forward(model_inputs, **forward_params)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiqingfe/transformers/src/transformers/pipelines/deprecated/text2text_generation.py", line 209, in _forward
    self.check_inputs(input_length, min_length, max_new_tokens)
  File "/home/jiqingfe/transformers/src/transformers/pipelines/deprecated/text2text_generation.py", line 301, in check_inputs
    if max_new_tokens < min_length:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'int'

```

### Expected behavior

Would you please let me know how to use `text-generation` pipeline to reproduce this example? Thanks!

Comments:
Older version - 4.X had:
`self.check_inputs(
            input_length,
            generate_kwargs.get("min_length", self.generation_config.min_length),
            generate_kwargs.get("max_length", self.generation_config.max_length),
        )`

Newer version - 5.X has:
`min_length = generate_kwargs.get("min_length", generate_kwargs["generation_config"].min_length)
        max_new_tokens = generate_kwargs.get("max_new_tokens", generate_kwargs["generation_config"].max_new_tokens)
        self.check_inputs(input_length, min_length, max_new_tokens)`

**It looks like max_length was removed and max_new_tokens was added but the backward compatibility fallback is missing.**

Workaround: Just swap max_length for max_new_tokens in your call:
`print(summarizer(ARTICLE, max_new_tokens=130, min_length=30, do_sample=False))
`

Hi @iavinas . Thanks for your reply. I can workaround it by setting min_length. As the text2text-generation pipeline is going to be deprecated, I want to know how to reproduce the summarization example by other pipelines, likethe  text-generation pipeline. The text-generation pipeline will load causal lm model while summarization requires conditional generation model.

cc @Rocketknight1 !

Hi @ArthurZucker  @Rocketknight1 . Since transformers are going to deprecate text2text pipeline, can I know how to reproduce the summarization example by pipeline? Thanks!

Hi @jiqing-feng - for most modern summarization cases, it's probably better to prompt a CLM. For example, asking a <10B Qwen or Gemma model to summarize an article will generate a much better summary than `bart-large-cnn`, which is quite old now. 

Thanks!
The new script could be
```python
from transformers import pipeline

summarizer = pipeline("text-generation", model="Qwen/Qwen2.5-3B-Instruct")

ARTICLE = """ New York (CNN)When Liana Barrientos was 23 years old, she got married in Westchester County, New York.
A year later, she got married again in Westchester County, but to a different man and without divorcing her first husband.
Only 18 days after that marriage, she got hitched yet again. Then, Barrientos declared "I do" five more times, sometimes only within two weeks of each other.
In 2010, she married once more, this time in the Bronx. In an application for a marriage license, she stated it was her "first and only" marriage.
Barrientos, now 39, is facing two criminal counts of "offering a false instrument for filing in the first degree," referring to her false statements on the
2010 marriage license application, according to court documents.
Prosecutors said the marriages were part of an immigration scam.
On Friday, she pleaded not guilty at State Supreme Court in the Bronx, according to her attorney, Christopher Wright, who declined to comment further.
After leaving court, Barrientos was arrested and charged with theft of service and criminal trespass for allegedly sneaking into the New York subway through an emergency exit, said Detective
Annette Markowski, a police spokeswoman. In total, Barrientos has been married 10 times, with nine of her marriages occurring between 1999 and 2002.
All occurred either in Westchester County, Long Island, New Jersey or the Bronx. She is believed to still be married to four men, and at one time, she was married to eight men at once, prosecutors say.
Prosecutors said the immigration scam involved some of her husbands, who filed for permanent residence status shortly after the marriages.
Any divorces happened only after such filings were approved. It was unclear whether any of the men will be prosecuted.
The case was referred to the Bronx District Attorney\'s Office by Immigration and Customs Enforcement and the Department of Homeland Security\'s
Investigation Division. Seven of the men are from so-called "red-flagged" countries, including Egypt, Turkey, Georgia, Pakistan and Mali.
Her eighth husband, Rashid Rajput, was deported in 2006 to his native Pakistan after an investigation by the Joint Terrorism Task Force.
If convicted, Barrientos faces up to four years in prison.  Her next court appearance is scheduled for May 18.
"""
ARTICLE = "Summarize the context: \n" + ARTICLE + "\n"
print(summarizer(ARTICLE, max_new_tokens=128, return_full_text=False))
```
output:
```
[{'generated_text': 'Summary:\n\nLiana Barrientos, a woman aged 39, is facing criminal charges for multiple marriages, which prosecutors claim were part of an immigration scam. Barrientos claims her marriages were "first and only" on her applications for marriage licenses, but she has been married ten times over a span of three years, with nine of those marriages occurring between 1999 and 2002. All of these marriages took place in Westchester County, Long Island, New Jersey, or the Bronx. Nine of the men who were married to Barrientos filed for permanent residence status shortly after their marriages, and'}]
```