Skip to content

cached_download from Huggin Face import error #2617

@valentin-martinez-gama

Description

@valentin-martinez-gama

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions