GPT2ForSequenceClassification logits unmatched size
### System Info

huggingface-hub-0.13.3 tokenizers-0.13.2 transformers-4.27.2
python3.9

Hi :)

Using GPT2ForSequenceClassification, I have num_labels > 1, but get logits with shape (batch_size,1) instead of (batch_size, config.num_labels) as written in the docs.

I verified that those values are correct:
config.num_classes
model.num_labels
and model.score Linear with the correct out_features.

I also debugged and the shape of _logits_ inside the forward method is correct, so seems like the problem is with the line:
pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]

maybe I didn't understand what it's supposed to do, but the result is getting logits in another shape than needed and than expected.

Will be glad for help, correction or clarification :)
Thank you!

### Who can help?

@ArthurZucker 


### Information

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

### Tasks

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

### Reproduction
```python
config = GPT2Config(vocab_size = num_classes,
                    n_embd = input_size,
                    n_layer = 12,
                    n_head = 8,
                    num_labels = num_classes
                    )

model = GPT2ForSequenceClassification(config).to(device)
model.config.pad_token_id = model.config.eos_token_id

outputs = model(inputs_embeds=inputs).logits
```

### Expected behavior

outputs.shape == (batch_size, config.num_labels)
Hi! 
I am not really sure about your usage (setting the vocabulary size to the number of classes?) but as it can be found on the documentation, this is how you should be using the `GPT2ForSequenceClassification` class : 
```python 
import torch
from transformers import GPT2Tokenizer, GPT2ForSequenceClassification

tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
model = GPT2ForSequenceClassification.from_pretrained("gpt2", num_labels = 4)

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_id = logits.argmax().item()
model.config.id2label[predicted_class_id]
```
```
'LABEL_3'
```
(and the shape of the logit is `[1,4]` as expected.
If the model was not trained on the specific task, by default it will not have the correct shape in the last output layer, so you will see the following warning: 
```python 
Some weights of GPT2ForSequenceClassification were not initialized from the model checkpoint at gpt2 and are newly initialized: ['score.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
```

Now regarding your issue, I simply suggest that there is something wrong with the shapes of the inputs that you are providing to your model. 
The following works:
```
config = GPT2Config(num_labels=4)
model = GPT2ForSequenceClassification(config)
logits = model(**inputs).logits 
assert logits.shape[-1] == 4
``` 
