Make inheritance consistent for classes having a `generate` method
### Feature request

Hi, I create this issue to see if this may be blocking to other people or not.

`GenerationMixin` does not inherit from `nn.Module`, while `WhisperForConditionalGeneration` does. Both now have a `generate` method.

This issue is to highlight that PRs as https://github.com/huggingface/transformers/pull/21252 may well break the workflow of users that expect `generate` to be defined in `GenerationMixin`, not inheriting from `nn.Module`. Such changes can either result in silent errors, or errors due to the unexpected inheritance.

For example, https://github.com/huggingface/transformers/pull/21252 make it close to impossible to have a `TensorRTModelForSpeechSeq2Seq(GenerationMixin)` class that does not inherit from nn.Module, use transformers generate, and is able to handle several architectures. Which was something possible before.

I don't have a better solution to propose right now, as I understand different models needing different `generate` will be a more common need in the future.

### Motivation

There is no reason to inherit from `nn.Module` to use `generate`.

### Your contribution

/
cc @gante @ArthurZucker <|||||>As seen in Slack, let's see if there is interest from others before acting on it, especially as the `generate` method for other modalities than text is prone to evolve to support other use-cases.

If anyone stumbles upon this issue as they're blocked by the above, please comment below to let us know. Thanks!<|||||>Thank you for raising the issue @fxmarty! 

I think this is an example of where improving the modularity on `.generate()` could benefit non-standard use cases. In particular for this issue, some models rewrite `.generate()` in the model class itself (`Whisper`, `BLIP`, `RAG`, ...) -- it could be avoided if we had some option to add pre- and post-processing steps to `.generate()`. I have an idea in the back of my mind, but I haven't put it into words.<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.