question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot import name 'Data2VecForCTC' from 'transformers'

See original GitHub issue

System Info

- `transformers` version: 4.18.0
- Platform: Linux-5.13.0-40-generic-x86_64-with-glibc2.31
- Python version: 3.9.7
- Huggingface_hub version: 0.2.1
- PyTorch version (GPU?): 1.11.0 (True)
- Tensorflow version (GPU?): 2.7.0 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

Who can help?

@patrickvonplaten

Information

  • The official example scripts
  • 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

Following the code sample in https://huggingface.co/facebook/data2vec-audio-large-960h I’m trying to import the name Data2VecForCTC, but unsuccessful. Possibly a typo: Data2VecForCTC -> Data2VecAudioForCTC

Expected behavior

Correct code sample is expected.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
NielsRoggecommented, Apr 28, 2022

But yes I’ll fix it, thanks for reporting

1reaction
patrickvonplatencommented, Apr 27, 2022

Here it is: https://github.com/huggingface/transformers/blob/dced262409177586bb510b6b724c762fb89da0e8/src/transformers/__init__.py#L880

Note that:

from transformers import Data2VecAudioForCTC

model = Data2VecAudioForCTC.from_pretrained("...")

should also already work on master

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wav2Vec2ForCTC and Wav2Vec2Tokenizer - Beginners
ImportError: cannot import name 'Wav2Vec2ForCTC' from 'transformers' (c:\python\python37\lib\site-packages\transformers_init_.py).
Read more >
How to resolve the hugging face error ImportError: cannot ...
SO related: Transformer: Error importing packages. "ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler'"; HF ...
Read more >
cannot import name 'pegasusforconditionalgeneration ...
The message suggests that the import is not available in your transformers installation. You should manually check that it has been installed ...
Read more >
transformer-utils
transformer -utils. Utilities for the HuggingFace transformers library, focused on loading and using large pretrained autoregressive language models like ...
Read more >
How to use the transformers.BertTokenizer function in ...
try: from torch.utils.tensorboard import SummaryWriter except ImportError: from tensorboardX import SummaryWriter logger = logging.getLogger(__name__) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found