Problem running T5 (configuration) with text classification
Author: ioana-blue
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.3.2
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.10
- Python version: 3.8.3
- PyTorch version (GPU?): 1.5.1+cu101 (True)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: single gpu

### Who can help

Perhaps @patrickvonplaten, @patil-suraj could help?

## Information

Model I am using (Bert, XLNet ...): T5

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

## To reproduce

I'm trying to run the T5 base model. It seems that I use the correct model path (i.e., t5-base) and it finds and downloads the model, but crashes when it tries to instantiate it. The problem seems to be around the configuration class not being found. This is what I get:

```
File "../../../models/tr-4.3.2/run_puppets.py", line 279, in main
    model = AutoModelForSequenceClassification.from_pretrained(
  File "/dccstor/redrug_ier/envs/last-tr/lib/python3.8/site-packages/transformers/models/auto/modeling_auto.py", line 1362, in from_pretrained
    raise ValueError(
ValueError: Unrecognized configuration class <class 'transformers.models.t5.configuration_t5.T5Config'> for this kind of AutoModel: AutoModelForSequenceClassification.
Model type should be one of ConvBertConfig, LEDConfig, DistilBertConfig, AlbertConfig, CamembertConfig, XLMRobertaConfig, MBartConfig, BartConfig, LongformerConfig, RobertaConfig, SqueezeBertConfig, LayoutLMConfig, BertConfig, XLNetConfig, MobileBertConfig, FlaubertConfig, XLMConfig, ElectraConfig, FunnelConfig, DebertaConfig, GPT2Config, OpenAIGPTConfig, ReformerConfig, CTRLConfig, TransfoXLConfig, MPNetConfig, TapasConfig.
```
I dig a bit and I may have a hunch why this happens. The config file is there: https://github.com/huggingface/transformers/blob/master/src/transformers/models/t5/configuration_t5.py#L32
but it's not recorded here: https://github.com/huggingface/transformers/blob/master/src/transformers/models/auto/modeling_auto.py#L514

So the check here fails: https://github.com/huggingface/transformers/blob/master/src/transformers/models/auto/modeling_auto.py#L1389

And the ValueError is raised. 

I hope this is it. It looks like an easy fix :) Thanks!

PS: I'm running the same scripts/files with other models without problems. This seems to be something specific to T5. 



Comments:
Hey, 

even though T5 can be used very well for text-classification it remains a text-to-text only model. So you can only load the model via

```python
from transformers import AutoModelForConditionalGeneration
model = AutoModelForConditionalGeneration.from_pretrained("t5-small")
```

Got it, thanks!

@patrickvonplaten Hi does `from transformers import AutoModelForConditionalGeneration` still work? Returns me an error when i try to use it

Should work yes :-)

@patrickvonplaten I just upgraded transformers to the latest version (4.16) and when i run this:

```python
from transformers import AutoModelForConditionalGeneration
```

I get this error:
```
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/tmp/ipykernel_20/1334627133.py in <module>
----> 1 from transformers import AutoModelForConditionalGeneration

ImportError: cannot import name 'AutoModelForConditionalGeneration' from 'transformers' (/opt/conda/lib/python3.7/site-packages/transformers/__init__.py)
```

If this is supposed to work I can open an issue (let me know who I should tag). See [kaggle notebook example](https://www.kaggle.com/xhlulu/transformers-automodelforconditionalgeneration)

Hi, I can confirm AutoModelForConditionalGeneration does not work in latest hf transformers...

Hey! You should probably use `AutoModelForCausalLM` or `AutoModelWithLMHead` depending on the model. `AutoModelForConditionalGeneration` does not exist anymore

@ArthurZucker Thank you! I want to get BartForConditionalGeneration from an auto model (i.e. want both an encoder and a decoder), thus I get it would be great to mention in doc how to get things like that when there is no exact match in auto model names.

You are probably looking for `AutoModelForSeq2SeqLM` ! 
It's a bit hard to know where the doc is failing in this case 😓 

Thank you!

> It's a bit hard to know where the doc is failing in this case 😓

I guess maybe the auto model page can discuss a bit about this. For example, adding a sentence saying "... names may not match, for example, to use BartForConditionalGeneration, you need AutoModelForSeq2SeqLM instead of (non-existing) AutoModelForConditionalGeneration"