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

cached_download from Huggin Face import error #2617

Closed
valentin-martinez-gama opened this issue Oct 20, 2024 · 4 comments
Closed

cached_download from Huggin Face import error #2617

valentin-martinez-gama opened this issue Oct 20, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@valentin-martinez-gama
Copy link

Describe the bug

Error coming up when trying to import SentenceTransformes in python

Other users finding the bug as seen in this other PR:

FunAudioLLM/CosyVoice#516

Reproduction

No response

Logs

ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/huggingface_hub/__init__.py)
File <command-2779289011728180>, line 13
     10 import json
     12 # sentence similarity
---> 13 from sentence_transformers import SentenceTransformer, InputExample
     14 from sentence_transformers.losses import MultipleNegativesRankingLoss
     15 from sentence_transformers.datasets import NoDuplicatesDataLoader
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/sentence_transformers/__init__.py:3
      1 __version__ = "2.2.2"
      2 __MODEL_HUB_ORGANIZATION__ = 'sentence-transformers'
----> 3 from .datasets import SentencesDataset, ParallelSentencesDataset
      4 from .LoggingHandler import LoggingHandler
      5 from .SentenceTransformer import SentenceTransformer
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/sentence_transformers/datasets/__init__.py:3
      1 from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset
      2 from .NoDuplicatesDataLoader import NoDuplicatesDataLoader
----> 3 from .ParallelSentencesDataset import ParallelSentencesDataset
      4 from .SentencesDataset import SentencesDataset
      5 from .SentenceLabelDataset import SentenceLabelDataset
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/sentence_transformers/datasets/ParallelSentencesDataset.py:4
      2 import logging
      3 import gzip
----> 4 from .. import SentenceTransformer
      5 from ..readers import InputExample
      6 from typing import List
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py:12
     10 from numpy import ndarray
     11 import transformers
---> 12 from huggingface_hub import HfApi, HfFolder, Repository, hf_hub_url, cached_download
     13 import torch
     14 from torch import nn, Tensor, device

System info

Copy-and-paste the text below in your GitHub issue.

- huggingface_hub version: 0.26.0
- Platform: Linux-5.15.0-1070-aws-x86_64-with-glibc2.35
- Python version: 3.11.0rc1
- Running in iPython ?: Yes
- iPython shell: DatabricksShell
- Running in notebook ?: Yes
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: /root/.cache/huggingface/token
- Has saved token ?: False
- Configured git credential helpers: cache
- FastAI: N/A
- Tensorflow: N/A
- Torch: 2.5.0
- Jinja2: 3.1.4
- Graphviz: N/A
- keras: N/A
- Pydot: N/A
- Pillow: 9.4.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.23.5
- pydantic: 1.10.6
- aiohttp: N/A
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /root/.cache/huggingface/hub
- HF_ASSETS_CACHE: /root/.cache/huggingface/assets
- HF_TOKEN_PATH: /root/.cache/huggingface/token
- HF_STORED_TOKENS_PATH: /root/.cache/huggingface/stored_tokens
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10

{'huggingface_hub version': '0.26.0',
 'Platform': 'Linux-5.15.0-1070-aws-x86_64-with-glibc2.35',
 'Python version': '3.11.0rc1',
 'Running in iPython ?': 'Yes',
 'iPython shell': 'DatabricksShell',
 'Running in notebook ?': 'Yes',
 'Running in Google Colab ?': 'No',
 'Running in Google Colab Enterprise ?': 'No',
 'Token path ?': '/root/.cache/huggingface/token',
 'Has saved token ?': False,
 'Configured git credential helpers': 'cache',
 'FastAI': 'N/A',
 'Tensorflow': 'N/A',
 'Torch': '2.5.0',
 'Jinja2': '3.1.4',
 'Graphviz': 'N/A',
 'keras': 'N/A',
 'Pydot': 'N/A',
 'Pillow': '9.4.0',
 'hf_transfer': 'N/A',
 'gradio': 'N/A',
 'tensorboard': 'N/A',
 'numpy': '1.23.5',
 'pydantic': '1.10.6',
 'aiohttp': 'N/A',
 'ENDPOINT': 'https://huggingface.co',
 'HF_HUB_CACHE': '/root/.cache/huggingface/hub',
 'HF_ASSETS_CACHE': '/root/.cache/huggingface/assets',
 'HF_TOKEN_PATH': '/root/.cache/huggingface/token',
 'HF_STORED_TOKENS_PATH': '/root/.cache/huggingface/stored_tokens',
 'HF_HUB_OFFLINE': False,
 'HF_HUB_DISABLE_TELEMETRY': False,
 'HF_HUB_DISABLE_PROGRESS_BARS': None,
 'HF_HUB_DISABLE_SYMLINKS_WARNING': False,
 'HF_HUB_DISABLE_EXPERIMENTAL_WARNING': False,
 'HF_HUB_DISABLE_IMPLICIT_TOKEN': False,
 'HF_HUB_ENABLE_HF_TRANSFER': False,
 'HF_HUB_ETAG_TIMEOUT': 10,
 'HF_HUB_DOWNLOAD_TIMEOUT': 10}
@valentin-martinez-gama valentin-martinez-gama added the bug Something isn't working label Oct 20, 2024
@valentin-martinez-gama
Copy link
Author

This breaking changes were introduced by by version 0.26.0. Reporting issue to SentenceTransformers

@hanouticelina
Copy link
Contributor

Hi @valentin-martinez-gama, thanks for reporting this! upgrading sentence-transformers to a later version sentence-transformers>=2.3.0 should fix this issue.

@selalipop
Copy link

The amount of software broken all over the internet because of this is staggering, out of curiosity, what drove the removal?

@Wauplin
Copy link
Contributor

Wauplin commented Jan 15, 2025

Hey there, maintainer of huggingface_hub here. Sorry for all the trouble this breaking change introduced. The best
-and future proof-solution to fix this is to upgrade diffusers version to a more recent version (>=0.29.0).

pip install "diffusers>=0.29.0"

This fixed version dates back to June 2024. The issue with pinning huggingface_hub to an old version is that it might conflict with future versions of diffusers/transformers/etc.

Hope this will prove useful 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants