huggingface-hubdiffusers

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


huggingface_hub==0.27.1 diffusers==0.28.0

I am getting this error:

Traceback (most recent call last):   File "/data/om/Lotus/infer.py", line 11, in <module>
    from diffusers.utils import check_min_version   File "/data/anaconda/envs/lotus/lib/python3.10/site-packages/diffusers/__init__.py", line 5, in <module>
    from .utils import (   File "/data/anaconda/envs/lotus/lib/python3.10/site-packages/diffusers/utils/__init__.py", line 38, in <module>
    from .dynamic_modules_utils import get_class_from_dynamic_module   File "/data/anaconda/envs/lotus/lib/python3.10/site-packages/diffusers/utils/dynamic_modules_utils.py", line 28, in <module>
    from huggingface_hub import cached_download, hf_hub_download, model_info ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/data/anaconda/envs/lotus/lib/python3.10/site-packages/huggingfa

Solution

  • pip install huggingface-hub==0.25.2
    

    cached_download(), url_to_filename(), filename_to_url() methods are now completely removed. From now on, you will have to use hf_hub_download() to benefit from the new cache layout.

    See: https://github.com/huggingface/huggingface_hub/releases/tag/v0.26.0