lllyasviel / Paints-UNDO

Understand Human Behavior to Align True Needs
Apache License 2.0
3.49k stars 310 forks source link

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

Open unsiao opened 1 day ago

unsiao commented 1 day ago

I'm encountering an ImportError when trying to run the gradio_app.py script. The error occurs specifically when importing cached_download from the huggingface_hub package. The full error message is as follows:

Traceback (most recent call last):
  File "/workspace/Paints-UNDO/gradio_app.py", line 19, in <module>
    from diffusers_helper.code_cond import unet_add_coded_conds
  File "/workspace/Paints-UNDO/diffusers_helper/code_cond.py", line 3, in <module>
    from diffusers.models.embeddings import TimestepEmbedding, Timesteps
  File "/root/miniforge3/envs/paints_undo/lib/python3.10/site-packages/diffusers/__init__.py", line 5, in <module>
    from .utils import (
  File "/root/miniforge3/envs/paints_undo/lib/python3.10/site-packages/diffusers/utils/__init__.py", line 38, in <module>
    from .dynamic_modules_utils import get_class_from_dynamic_module
  File "/root/miniforge3/envs/paints_undo/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' (/root/miniforge3/envs/paints_undo/lib/python3.10/site-packages/huggingface_hub/__init__.py)

Steps to Reproduce:

  1. Set up the environment by following the project setup instructions.
  2. Run the gradio_app.py script.
  3. The error occurs when attempting to import cached_download from huggingface_hub.

Environment:

Possible Cause: It seems like the huggingface_hub package may have been updated or changed, resulting in the absence of cached_download. The API may have changed or the function might have been removed in the latest version.

Expected Behavior: The script should run without any import errors. The cached_download function should be available for use within the huggingface_hub package.

Suggested Fix:

Additional Notes: