Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running inference using HuggingFace spaces: AttributeError: 'Wav2Vec2CTCTokenizer' object has no attribute 'unique_no_split_tokens' #5334

Closed
andergisomon opened this issue Sep 23, 2023 · 2 comments

Comments

@andergisomon
Copy link

andergisomon commented Sep 23, 2023

🐛

I ran inferences using HuggingFace spaces and it worked without issue until recently when wav2vec2 outputs an error.

To Reproduce

I used HuggingFace AutoProcessor to load the wav2vec2 model:

LANG = "dtp" #Change to tih for Timugon Murut or iba for Iban
model_id = "facebook/mms-1b-all"  
processor = AutoProcessor.from_pretrained(model_id)
model = Wav2Vec2ForCTC.from_pretrained(model_id).to("cpu")
processor.tokenizer.set_target_lang(LANG)

It failed on the last line, where the terminal outputs:

Traceback (most recent call last):
  File "/home/user/app/app.py", line 24, in <module>
    processor.tokenizer.set_target_lang(LANG)
  File "/home/user/.local/lib/python3.10/site-packages/transformers/models/wav2vec2/tokenization_wav2vec2.py", line 237, in set_target_lang
    self.unique_no_split_tokens.append(token)
AttributeError: 'Wav2Vec2CTCTokenizer' object has no attribute 'unique_no_split_tokens'

Expected behavior

It should throw no errors and run absolutely fine.

Environment

  • fairseq Version: 0.12.2
  • PyTorch Version: 2.0.1
  • OS: Linux
  • How you installed fairseq: pip
  • Python version: 3.10
@andergisomon
Copy link
Author

This might not be related to wav2vec at all. Refer here: huggingface/transformers#26349

@andergisomon
Copy link
Author

Simply downgrade your transformers version. I think this issue came from 4.33.2. Downgrading to 4.30.2 fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant