# Wav2Vec2ForCTC and Wav2Vec2Tokenizer

**URL:** <https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587>\
**Category:** Beginners\
**Created:** [February 10, 2021, 3:49pm UTC](https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587 "2021-02-10T15:49:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asomoza](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@asomoza](https://discuss.huggingface.co/u/asomoza)\
**Post date:** [February 10, 2021, 3:49pm UTC](https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587/1 "2021-02-10T15:49:16Z")

</div>

Having installed transformers and trying:

import transformers  
import librosa  
import soundfile as sf  
import torch  
from transformers import Wav2Vec2ForCTC  
from transformers import Wav2Vec2Tokenizer

#load model and tokenizer  
tokenizer = Wav2Vec2Tokenizer.from\_pretrained(“facebook/wav2vec2-base-960h”)  
model = Wav2Vec2ForCTC.from\_pretrained(“facebook/wav2vec2-base-960h”)

I get:

ImportError Traceback (most recent call last)  
 in   
3 import soundfile as sf  
4 import torch  
----\> 5 from transformers import Wav2Vec2ForCTC  
6 from transformers import Wav2Vec2Tokenizer  
7

ImportError: cannot import name ‘Wav2Vec2ForCTC’ from ‘transformers’ (c:\python\python37\lib\site-packages\transformers\__init_\_.py)

How I install/get Wav2Vec2ForCTC and Wav2Vec2Tokenizer ???

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](https://discuss.huggingface.co/u/sgugger)\
**Post date:** [February 10, 2021, 5:14pm UTC](https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587/2 "2021-02-10T17:14:59Z")

</div>

This probably means you don’t have the latest version. You should check your version of Transformers with

```auto
import transformers
print(transformers. __version__ )

```

and if you don’t see at least 4.3.0, you will need to upgrade your install.

---

<div class="post-metadata">

**Author:** ![arossbach](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@arossbach](https://discuss.huggingface.co/u/arossbach)\
**Post date:** [February 11, 2021, 11:01am UTC](https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587/3 "2021-02-11T11:01:09Z")

</div>

I have the same issue with Windows 10.

> pip install transformers[torch]==4.3

> import transformers  
> print(transformers. **version** )  
> 4.3.0  
> from transformers import Wav2Vec2Tokenizer, Wav2Vec2ForCTC  
> Traceback (most recent call last):  
> File “”, line 1, in   
> ImportError: cannot import name ‘Wav2Vec2ForCTC’

---

<div class="post-metadata">

**Author:** ![purnasai](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@purnasai](https://discuss.huggingface.co/u/purnasai)\
**Post date:** [February 12, 2021, 7:04am UTC](https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587/4 "2021-02-12T07:04:43Z")

</div>

I had the same issue. I upgraded the transformers version from 4.3.0 to 4.3.2 with  
`pip install transformers==4.3.2`  
and that worked for me. Also, upgrade your PyTorch to its latest version 1.7 with  
`pip install torch==1.7`  
that avoids error while loading pre-trained weights in the next step.

---

<div class="post-metadata">

**Author:** ![Sreosha](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Sreosha](https://discuss.huggingface.co/u/Sreosha)\
**Post date:** [July 15, 2021, 10:53am UTC](https://discuss.huggingface.co/t/wav2vec2forctc-and-wav2vec2tokenizer/3587/6 "2021-07-15T10:53:49Z")

</div>

use " from transformers import \*" instead of “from transformers import Wav2Vec2Tokenizer, Wav2Vec2ForCTC”
