Add easy extensibility of `logits_processor` to `generate`
Author: eranhirs
Pull request: no

### Feature request

It is easy to change the behavior of `generate` with the config.
However, `logits_processor` is not read from the config, but only received [as a parameter](https://github.com/huggingface/transformers/blob/main/src/transformers/generation_utils.py#L874).

This is hard to accomplish because both [`Trainer`](https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L2798) and [`Seq2SeqTrainer`](https://github.com/huggingface/transformers/blob/main/examples/legacy/seq2seq/seq2seq_trainer.py#L223) don't tunnel this parameter.

I guess my feature request is to either have it easily read from the config, or easily sent as a parameter to the different `Trainer` and `Seq2SeqTrainer` methods, such as `predict`.

### Motivation

Generation of text is known to have many problems, as well described in this article https://huggingface.co/blog/how-to-generate .
As we advance towards different types of textual inputs which are not simply natural language texts, such as semi-structured texts (e.g., linearized graphs), the ability to research new beam search ideas for different use cases is paramount.
We run into this need in two of my latest research projects. The problem is that this is not always the main contribution, and if it becomes too complicated (e.g., stop using `Trainer` abstractions), researchers might not follow through.

### Your contribution

I could submit a PR, but would like to first discuss its design.

Comments:
Hey @eranhirs 👋  On the `generate` end, if I recall correctly (I can't find the discussion), we want to steer away from controlling generation from the `config` file -- cc @patrickvonplaten.

Maybe we can pass generation kwargs to `Seq2SeqTrainer` -- WDYT @sgugger?

Yes, we could add all generation kwargs to `predict` and `evaluate` in the `Seq2SeqTrainer`.

@eranhirs would you like to open a PR? :D 

Perfect, thanks! Yes I will open a PR 👍 

Could we also pass generate arguments to [Seq2SeqTrainerArguments](https://github.com/huggingface/transformers/blob/d0acc9537829e7d067edbb791473bbceb2ecf056/src/transformers/training_args_seq2seq.py#L28) directly? This would be very cool so that we could use things like `logits_processor` in the validation step!

cc @gante @sgugger 

`Seq2SeqTrainingArguments` is only there to provide an easy way to have arguments in the CLI, and you can't pass instances of logits processors as CLI arguments, so I don't see what adding this here would add.

> `Seq2SeqTrainingArguments` is only there to provide an easy way to have arguments in the CLI, and you can't pass instances of logits processors as CLI arguments, so I don't see what adding this here would add.

What about adding the argument to `Seq2SeqTrainer` then? When `predict_with_generate=True`, we should be able to pass all the `generate` arguments we want, right?

Or you could just pass them along when you call `evaluate` and `predict`. There are already 94 arguments in `Seq2SeqTrainingArguments`.

What if I want to early stop with the metric being calculated with `logits_processor`, for example?

You should then use Accelerate to be able to customize the training loop to your needs :-)