No way to pass max_length/max_new_tokens to generate for image-to-text pipeline
Author: davidmezzetti
Pull request: no

### System Info

Transformers 4.23.1

### Who can help?

@narsil

### Information

- [ ] 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

```python
from transformers import pipeline
nlp = pipeline("image-to-text")
nlp("image.jpg", max_length=20)
```

Results in

```
transformers/generation_utils.py:1301: UserWarning: Neither `max_length` nor `max_new_tokens` has been set
```

### Expected behavior

No warning or a way to disable the warning. This warning is also raised with the `automatic-speech-recognition` pipeline when using the OpenAI Whisper model.

Comments:
The warning is there, and can be safely ignored in both situations IMO.

The generation should stop when the model says it's OK, not when you decide it's too big.
Having `max_new_tokens` in place, would definitely help prevent computing indefinitely if the actual generation never hits EOS so the generation never stopped though.

This is what the warnings is trying to warn you about.

@gante @patrickvonplaten 
What do you think we should do in that situation ?

I think calling `generate` with neither `max_length` nor `max_new_tokens` is perfectly OK if you expect EOS to be hit.
You are running the risk of having an infinite loop (well it would crash when the model OOMS or runs into it's max_length capacity...)

What do you think about defaulting the model max capacity for `max_length` and silencing the warning ?
Since we modified this behavior not too long ago, I understand why the current warning is there, so we could silence the warning much later or by opt-in (so that users that know what they are doing can silence it, but others are still warned).



Being able to choose `max_new_tokens` in the pipeline should always be doable, since that's a very easy way to prevent an application from randomly crashing when you know that the generation for images should never be too long for instance.

@OlivierDehaene also since you worked on `image-to-text`.



@Narsil @patrickvonplaten default `max_length` strikes again :D 

Note: any change would have to happen in the context of a major version change. That being said, both defaults have their shortcomings: defaulting to `20` results in short outputs that might be misinterpreted as poor outputs; defaulting to the model's maximum length might not be feasible (e.g. T5), or cause crashes due to memory requirements. A third option would be to make it a required argument (in `generate()`), but that would add friction to text generation 🤔 I honestly don't know which would be the best option.

I think the whisper models should define a max_length or `max_new_tokens` in the config actually (ideally in the "future" generation config). 

Regarding whisper, the model cannot process more than 30seconds of speech which is means that max_length/max_new_tokens almost never goes over 256, so a good/reasonable default for whisper would be 256. Until we don't have better generation configs I think we should set the model config to 256. 

Also cc'ing @ArthurZucker and @sanchit-gandhi here FYI.

To understand better, we get the warning here only because the user passes `max_length=20` which happens to be exactly equal to our default-default max_length in `configuration_utils.py` here: https://github.com/huggingface/transformers/blob/c7edde1a692012eda23bc2b837588557b97ad729/src/transformers/configuration_utils.py#L278 no?