AnimateDiff icon indicating copy to clipboard operation
AnimateDiff copied to clipboard

ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/usr/local/lib/python3.11/dist-packages/huggingface_hub/__init__.py)

Open DjamilDowlut opened this issue 8 months ago • 6 comments

ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/usr/local/lib/python3.11/dist-packages/huggingface_hub/init.py)

When running on colab. Can someone help please?

DjamilDowlut avatar May 12 '25 06:05 DjamilDowlut

Downgrading huggingface_hub to 0.25.0 helped me resolve the issue.

lhxatus avatar May 13 '25 04:05 lhxatus

Edit:forgot to say Thank!

!pip install huggingface_hub==0.25.2

/content/animatediff Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/content/animatediff/scripts/animate.py", line 9, in import diffusers File "/usr/local/lib/python3.11/dist-packages/diffusers/init.py", line 46, in from .pipeline_utils import DiffusionPipeline File "/usr/local/lib/python3.11/dist-packages/diffusers/pipeline_utils.py", line 38, in from .schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME File "/usr/local/lib/python3.11/dist-packages/diffusers/schedulers/init.py", line 51, in from .scheduling_ddpm_flax import FlaxDDPMScheduler File "/usr/local/lib/python3.11/dist-packages/diffusers/schedulers/scheduling_ddpm_flax.py", line 80, in class FlaxDDPMScheduler(FlaxSchedulerMixin, ConfigMixin): File "/usr/local/lib/python3.11/dist-packages/diffusers/schedulers/scheduling_ddpm_flax.py", line 216, in FlaxDDPMScheduler key: random.KeyArray, ^^^^^^^^^^^^^^^ AttributeError: module 'jax.random' has no attribute 'KeyArray'

this is what i get. someone else here also postex same thing

DjamilDowlut avatar May 13 '25 07:05 DjamilDowlut

ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/usr/local/lib/python3.11/dist-packages/huggingface_hub/init.py)

When running on colab. Can someone help please?

Same error here. I'm using uv for runtime management. Here's my pyproject.toml (downgrading to 0.25.0 worked!).

[project]
name = "animatediff"
version = "0.1.0"
description = "animatediff"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "decord==0.6.0",
    "diffusers==0.11.1",
    "einops>=0.8.1",
    "gradio==3.36.1",
    "huggingface-hub==0.25.0",
    "imageio==2.27.0",
    "imageio-ffmpeg==0.4.9",
    "omegaconf==2.3.0",
    "safetensors>=0.5.3",
    "torch==2.3.1",
    "torchvision==0.18.1",
    "transformers==4.25.1",
    "wandb>=0.19.11",
    "xformers==0.0.27",
]

gwicho38 avatar May 16 '25 03:05 gwicho38

remove the import cached_download from this path diffusers/init/.pipeline_utils/.dynamic_modules_utils in this file it have import cached_download and have not used in anywhere

pylab-with-Absar avatar May 20 '25 09:05 pylab-with-Absar

transformers==4.36.2 diffusers==0.25.0 accelerate==0.27.2 torch==2.1.2 huggingface_hub==0.16.4 opencv-python gradio==4.15.0 imageio imageio-ffmpeg

tools4profit avatar May 23 '25 18:05 tools4profit

import gradio as gr from diffusers import AnimateDiffPipeline import torch

Charger le pipeline (change le modèle si nécessaire)

pipe = AnimateDiffPipeline.from_pretrained( "guoyww/AnimateDiff", torch_dtype=torch.float16 ).to("cuda")

Fonction de génération d'animation

def generate(prompt): video = pipe(prompt).frames return video

Interface Gradio

demo = gr.Interface( fn=generate, inputs=gr.Textbox(label="Texte d'entrée"), outputs=gr.Video(label="Vidéo générée"), title="AnimateDiff" )

demo.launch()

tools4profit avatar May 23 '25 18:05 tools4profit