feed `input_embeds` into `FlaxT5ForConditionalGeneration`
Author: BigRedT
Pull request: yes

This is a PR requested by @sanchit-gandhi in [https://github.com/huggingface/transformers/issues/18036#issuecomment-1214131955](https://github.com/huggingface/transformers/issues/18036#issuecomment-1214131955)

To summarize the issue - Flax encoder-decoder models are currently missing `input_embeds` argument, unlike the non-flax models. In this PR, I have added this argument for `FlaxT5ForConditionalGeneration` model and showed how this may be used for feeding features from other modalities such as vision into a language model such as `T5`.

Please run [examples/flax/vision-language/t5_for_vl.py](examples/flax/vision-language/t5_for_vl.py) for testing this feature.

Here's the output you should see:
```
--------------------------------------------------------------------------------
Model Input -> summarize: The US has "passed the peak" on new coronavirus cases, President Donald Trump said and predicted that some states would reopen this month. The US has over 637,000 confirmed Covid-19 cases and over 30,826 deaths, the highest for any country in the world. At the daily White House coronavirus briefing on Wednesday, Trump said new guidelines to reopen the country would be announced on Thursday after he speaks to governors.
--------------------------------------------------------------------------------
Summary from input_ids -> the country has over 637,000 confirmed cases and more than 30,826 deaths . the latest cases could be announced monday after speaking to governors .
--------------------------------------------------------------------------------
Summary from input_embeds -> the country has over 637,000 confirmed cases and more than 30,826 deaths . the latest cases could be announced monday after speaking to governors .
--------------------------------------------------------------------------------
Summary after concatenating random visual embeddings ->  the country has over 637,000 confirmed cases and more than 30,826 deaths . the latest cases could be announced monday after a tuesday vote .
```

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_18613). All of your documentation changes will be reflected on that endpoint.

Hey @BigRedT! Awesome that you've managed to get it working with so little code! And great to see that the model outputs are the same for `input_ids` and `input_embeds`. Before we can merge this we'll need to add some tests to make sure the functionality is as expected (which is should hopefully be given the toy example passes!). At the very least, we should add one test that mirrors the PyTorch test:
https://github.com/huggingface/transformers/blob/1ccd2515ed6d7da4ec46fe94aedbd8a86a2cde8e/tests/test_modeling_common.py#L2094
And one that verifies that the output logits for `input_ids` and `input_embeds` match. Do you want to have a go at this?

If you have any questions/issues, feel free to reach out to @patrickvonplaten or @patil-suraj. They will be more than happy to lend you a hand and provide a review on this PR! Otherwise I can take a look in a little over a weeks time! Thanks @BigRedT!

@sanchit-gandhi thanks for helping with this! Will take a look in the coming week. 

Added `test_input_embeds()` to `FlaxT5ModelTest` in `test_modeling_flax_t5.py` as requested by @sanchit-gandhi 

This test currently checks to see if the generated sequences from `input_ids` match those from `input_embeds` (obtained by feeding `input_ids` through the `shared` embedding layer in the model)

@sanchit-gandhi wanted to see if the logits match too. @patrickvonplaten @patil-suraj what's the easiest way to compute logits from `generate()`. Also, could one of you review this PR. Thanks!



@sanchit-gandhi any updates?

Hey @BigRedT, let me know if you want any further clarification for the comments. Happy to answer any questions! This PR looks pretty close to completion :)

Hey @BigRedT - do you want to see this PR to completion? We're pretty close now! 🤗

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.