Summarization pipeline giving different outputs when num_beams=1 or num_beams not set (should default to 1)
Author: AndreaSottana
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.21.3
- Platform: Linux-5.15.0-33-generic-x86_64-with-glibc2.35
- Python version: 3.10.4
- Huggingface_hub version: 0.9.1
- PyTorch version (GPU?): 1.11.0+cu113 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes (but issue is also encountered when using CPU only)
- Using distributed or parallel set-up in script?: No

### Who can help?

@Narsil

### Information

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

### Tasks

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

### Reproduction

I'm having an issue when using a summarization pipeline whereby when setting `num_beams=1` or not setting `num_beams` at all I get different results. Unfortunately the documentation does not specify what default value is used for `num_beams` and I tried to trace the code back looking at the following parent classes, `SummarizationPipeline`, `Text2TextGenerationPipeline`, `Pipeline` but none of them contain `num_beams` mentioned anywhere in the code so I couldn't figure out exactly where this is passed as `**kwargs`, however from reading some online non-official examples I understand the the default should be `num_beams=1`. While I'm using my own model and using much longer text inputs, the following lines below with a short input using the default model are enough to reproduce the behaviour.

```python
from transformers import pipeline
summarizer = pipeline("summarization")
summarizer("I went to the cinema yesterday to watch Pinocchio which is an Italian movie starring Roberto Benigni based on a novel written by Carlo Collodi")
```

gives the following output
```
[{'summary_text': ' Pinocchio is an Italian movie starring Roberto Benigni based on a novel written by Carlo Collodi . The film is based on an Italian novel, written by Collodi, and is based upon a novel by the same author . The movie is set to be released on Blu-Ray in cinemas this week .'}]
```

while 
```python
from transformers import pipeline
summarizer = pipeline("summarization", num_beams=1)
summarizer("I went to the cinema yesterday to watch Pinocchio which is an Italian movie starring Roberto Benigni based on a novel written by Carlo Collodi")
```
gives the following output
```
[{'summary_text': ' Pinocchio is an Italian movie starring Roberto Benigni based on a novel written by Carlo Collodi . The film is based on the novel written in Italy by CarloCollodi . Pinocchi is a classic Italian film starring Roberto\xa0Benigni . The movie is a new series of films from the same Italian film company .'}]
```

### Expected behavior

I would expect the two outputs above to be the same.

As a further suggestion for improvement, I also think it would be a good idea to include all possible parameters of a summarization pipeline, such as `num_beams`, `do_sample`, `no_repeat_ngram_size` etc. in the documentation clearly so that their usage, along with default values, is shown when printing `help(summariser)` otherwise someone has to rummage through the internal code or read online tutorials to know what parameters they can use and what they do.


Comments:
Hi @AndreaSottana 

The amount of parameters is something we are actually to control as it sometimes explodes:
https://huggingface.co/docs/transformers/v4.22.1/en/main_classes/text_generation#transformers.generation_utils.GenerationMixin.generate

All those are available to `summarization` pipeline in addition to many more actually. Since the docs becomes unreadable when bloated with too many args, that's why they are purposefully ommitted sometimes. 

That being said you're right that having a link might be helpful and still contain a little the complexity.
Would you wiling to open an PR on that (just adding a link to the `generate` doc in the docstring ?).


As for the outputs being different, this is normal, the default for this model is stored in its `config.json`. https://huggingface.co/sshleifer/distilbart-cnn-12-6/blob/main/config.json

So it's using `num_beams=4` by default. 
We're trying to refrain from using defaults within models, but it is sometimes extremely helpful for reproducibility and having good defaults per model so that users don't have to care about them. (But it makes their discoverability worse, that's why we try not to abuse this).

Done, PR is here https://github.com/huggingface/transformers/pull/19227.