

TITLE
GPT2.generate() with custom input_embeds argument returning tensor (1*max_length) instead of (batch_size*max_length)

COMMENTS
5

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
### System Info

```shell
- `transformers` version: 4.17.0
- Platform: Linux-4.15.0-175-generic-x86_64-with-glibc2.27
- Python version: 3.9.7
- PyTorch version (GPU?): 1.10.1 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: Nope
```


### Who can help?

@patrickvonplaten, @patil-suraj

Hi everybody I have a problem/bug to report regarding the .generate() function, when using GPT2 with custom embeddings instead of embedding ID's. 

When using it like stated below with custom input_embeds, the output shape of the longtensor is [1,maxlength] instead of [batch_size, maxlength]. I am confused as to why this happens. 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

import torch.nn as nn
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BartForConditionalGeneration

MOD = AutoModelForCausalLM.from_pretrained("nferruz/ProtGPT2").to('cuda:0')

Out = MOD.generate(input_embeds=torch.rand(3,314,1280).to('cuda:0'), max_length=40, temperature=1.0, repetition_penalty=1.2, top_k=950, num_return_sequences=1, do_sample=True, top_p=1.0)

Out.shape

### Expected behavior

```shell
Expected shape of Out = [batch_size, maxlength]
```
