AttributeError: type object 'Wav2Vec2ForCTC' has no attribute 'from_pretrained'
Author: margotwagner
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.6.1
- Platform: macOS-10.15.7-x86_64-i386-64bit
- Python version: 3.8.5
- PyTorch version (GPU?): 1.9.0 (False)
- Tensorflow version (GPU?): 2.3.1 (False)
- Using GPU in script?:  no
- Using distributed or parallel set-up in script?: distributed

### Who can help
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @Rocketknight1

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

Model hub:

- for issues with a model report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->
@patrickvonplaten 

## Information

Model I am using (Bert, XLNet ...): wav2vec2

The problem arises when using:
* [x] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [x] an official GLUE/SQUaD task: (give the name)
* [ ] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:
Note: following the tutorial: https://huggingface.co/blog/fine-tune-wav2vec2-english
1. Follow all the steps in the tutorial until you get to 'Set-up Trainer' under 'Training & Evaluation'
2. Follow the code written until you load the pretrained Wav2Vec2 checkpoint
3. Run this code segment

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->
Code segment:
```python
from transformers import Wav2Vec2ForCTC

model = Wav2Vec2ForCTC.from_pretrained(
    "facebook/wav2vec2-base", 
    gradient_checkpointing=True, 
    ctc_loss_reduction="mean", 
    pad_token_id=processor.tokenizer.pad_token_id,
)
```

Stack trace:
```python
AttributeError: type object 'Wav2Vec2ForCTC' has no attribute 'from_pretrained'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/wp/3f0wwp4n2yzg421rx1jgph980000gn/T/ipykernel_18308/401638209.py in <module>
      1 from transformers import Wav2Vec2ForCTC
      2 
----> 3 model = Wav2Vec2ForCTC.from_pretrained(
      4     "facebook/wav2vec2-base",
      5     gradient_checkpointing=True,

AttributeError: type object 'Wav2Vec2ForCTC' has no attribute 'from_pretrained'
```
## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->
Code runs without error and produces the following Log Output:
```python
    Some weights of Wav2Vec2ForCTC were not initialized from the model checkpoint at facebook/wav2vec2-base and are newly initialized: ['lm_head.weight', 'lm_head.bias']
    You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
```


Comments:
Also having this issue!

Hey @margotwagner - could you provide a google colab that reproduces the error? Usually it's a missing dependency that triggers that problem. You can try to reinstall `transformers` with

```
pip install transformers -e ".[speech]"
```

and I think it should work

This fixed it, thanks!