Generate: validate arguments
# What does this PR do?

NOTE: this PR is very experimental, feel free to trash it in the review process :)

A common cause for issues in `generate` is around it not behaving as expected, as arguments can be silently ignored as part of the selected generation submethod (greedy_search, sample, ...). Typos also often fly under the radar, as the method accepts `**model_kwargs`, which in turn are passed to models that also accept `**kwargs`.

This PR adds argument validation to `generate` in two separate steps:
1. `model_kwargs` are verified as soon as the method is called. Only arguments that the model actually uses in `prepare_inputs_for_generation` or in its forward pass are accepted. This means that typos are caught immediately. The exception enumerates all arguments that triggered this failed check, so the user can correct them.
2. Before calling the appropriate generate submethod, which is picked from the arguments, checks that all passed arguments will actually be used. If the user passes an argument that is not used in that particular submethod, throws an exception indicating the submethod that was triggered and the unaccepted arguments, so the user can fix either problem (correct the submethod or correct the arguments).

Although I think the checks are super useful, the code around it is not the prettiest. The first check has some logic for edge cases, and the second case requires passing the list of methods that will be called before the submethod in question. The PR is heavily commented in GH, feel free to cast your judgment!

P.S.: (seemingly) unrelated accelerate tests are failing in `run_examples_torch`

### Related issues
- https://github.com/huggingface/transformers/issues/18130
- https://github.com/huggingface/transformers/pull/17196
- (many other issues where users were confused because they were trying to use certain arguments that had no effect on the picked submethod)
_The documentation is not available anymore as the PR was closed or merged._<|||||>> For 2, the way you chose feels very very magical with lots of ad-hoc code that is going to be hard to maintain.

Yeah, I agree, that was the number 1 reason why I left so many comments and caveats. It works but would be annoying to maintain.

(@sgugger) If I got it right, the suggestion was to pop used arguments from `generation_inputs` as we call functions, correct? Something like `consume_arguments(generation_inputs, <function that was just called>)` after most calls, with a small validation function at the end of generate?

Meanwhile, I'm going to do as suggested, and move the model kwargs validation to its own PR :)<|||||>> Something like consume_arguments(generation_inputs, <function that was just called>) after most calls, with a small validation function at the end of generate

No, something more like `result, generation_inputs = <function to call>(generation_inputs)`<|||||>Closing in place of two PRs:
- https://github.com/huggingface/transformers/pull/18261 for the model_kwargs validation
- TBD for the validation of other arguments, as per comments above