LAION-AI / LAION-AI/CLAP

Error on laion_clap import

Open
#171 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.3k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

After installation with pip install laion-clap, calling import laion_clap produces following error:
(transformers version 4.30.2)

Traceback (most recent call last):
  File "C:\Users\valli\Desktop\work\VCS\main\project_1_search\clap_test.py", line 1, in <module>
    import laion_clap
  File "C:\Users\valli\.virtualenvs\project_1_search-HY9YXE2J\lib\site-packages\laion_clap\__init__.py", line 5, in <module>
    from .hook import CLAP_Module
  File "C:\Users\valli\.virtualenvs\project_1_search-HY9YXE2J\lib\site-packages\laion_clap\hook.py", line 12, in <module>
    from .training.data import get_audio_features
  File "C:\Users\valli\.virtualenvs\project_1_search-HY9YXE2J\lib\site-packages\laion_clap\training\data.py", line 44, in <module>
    bert_tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
  File "C:\Users\valli\.virtualenvs\project_1_search-HY9YXE2J\lib\site-packages\transformers\tokenization_utils_base.py", line 1784, in from_pretrained
    resolved_vocab_files[file_id] = cached_file(
  File "C:\Users\valli\.virtualenvs\project_1_search-HY9YXE2J\lib\site-packages\transformers\utils\hub.py", line 433, in cached_file
    raise EnvironmentError(
OSError: bert-base-uncased is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass `use_auth_token=True`.

After testing, the Error could be resolved by replacing BertTokenizer.from_pretrained("bert-base-uncased") with BertTokenizer.from_pretrained("https://huggingface.co/google-bert/bert-base-uncased") in laion_clap\training\data.py

This error occurs on import, so i assume this isn't expected behaviour, even though i can see BertTokenizer.from_pretrained("bert-base-uncased") beeing used in many other projects as well. So i'm not sure if this is a transformer bug, or a bug in laion_clap, either way i'm not sure how to keep using clap if i cannot import.
Thanks for any help...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported import failure with transformers 4.30.2, then inspect laion_clap/training/data.py where BertTokenizer.from_pretrained is called during import. Verify the tokenizer reference against the reported Hugging Face location and confirm that importing laion_clap completes without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.