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

ImportError: cannot import name 'cached_download' from 'huggingface_hub' #3001

Closed
martina-zxy opened this issue Oct 18, 2024 · 2 comments
Closed

Comments

@martina-zxy
Copy link

huggingface_hub had a new release yesterday that removes cached_download and causes an ImportError

image

/usr/local/lib/python3.11/site-packages/sentence_transformers/__init__.py:3: in <module>
    from .datasets import SentencesDataset, ParallelSentencesDataset
/usr/local/lib/python3.11/site-packages/sentence_transformers/datasets/__init__.py:3: in <module>
    from .ParallelSentencesDataset import ParallelSentencesDataset
/usr/local/lib/python3.11/site-packages/sentence_transformers/datasets/ParallelSentencesDataset.py:4: in <module>
    from .. import SentenceTransformer
/usr/local/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py:12: in <module>
    from huggingface_hub import HfApi, HfFolder, Repository, hf_hub_url, cached_download
E   ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/usr/local/lib/python3.11/site-packages/huggingface_hub/__init__.py)
@tomaarsen
Copy link
Collaborator

Hello!

I believe cached_download was removed in Sentence Transformers in the v2.3.0 release, so if you upgrade Sentence Transformers to v2.3.0 or newer then you shouldn't have any issues.
P.s. on the inference side, the v3 release from a few months back shouldn't have introduced anything breaking, so it should be safe to upgrade.

  • Tom Aarsen

@martina-zxy
Copy link
Author

Thanks @tomaarsen!

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

Successfully merging a pull request may close this issue.

2 participants