module diffusers has no attribute HiDreamImagePipeline

#6
by khanakia - opened

I am using this example

from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained("HiDream-ai/HiDream-I1-Dev")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]

and getting error

(.venv) ➜  huggingface-course git:(main) ✗ python diffuser2.py
Traceback (most recent call last):
  File "/Volumes/D/www/ai/huggingface-course/diffuser2.py", line 3, in <module>
    pipe = DiffusionPipeline.from_pretrained("HiDream-ai/HiDream-I1-Dev")
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/diffusers/pipelines/pipeline_utils.py", line 773, in from_pretrained
    cached_folder = cls.download(
        pretrained_model_name_or_path,
    ...<14 lines>...
        **kwargs,
    )
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/diffusers/pipelines/pipeline_utils.py", line 1473, in download
    pipeline_class = _get_pipeline_class(
        cls,
    ...<7 lines>...
        revision=custom_revision,
    )
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 427, in _get_pipeline_class
    pipeline_cls = getattr(diffusers_module, class_name)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/diffusers/utils/import_utils.py", line 813, in __getattr__
    raise AttributeError(f"module {self.__name__} has no attribute {name}")
AttributeError: module diffusers has no attribute HiDreamImagePipeline

We recommend to install initialize pipeline following this command:

import torch
from transformers import PreTrainedTokenizerFast, LlamaForCausalLM
from diffusers import HiDreamImagePipeline
tokenizer_4 = PreTrainedTokenizerFast.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct")
text_encoder_4 = LlamaForCausalLM.from_pretrained(
    "meta-llama/Meta-Llama-3.1-8B-Instruct",
    output_hidden_states=True,
    output_attentions=True,
    torch_dtype=torch.bfloat16,
)

pipe = HiDreamImagePipeline.from_pretrained(
    "HiDream-ai/HiDream-I1-Full",  # "HiDream-ai/HiDream-I1-Dev" | "HiDream-ai/HiDream-I1-Fast"
    tokenizer_4=tokenizer_4,
    text_encoder_4=text_encoder_4,
    torch_dtype=torch.bfloat16,
)

pipe = pipe.to('cuda')

Getting this error if i run above code

ImportError: cannot import name 'HiDreamImagePipeline' from 'diffusers' (/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/diffusers/__init__.py)

maybe we are using the not compatible version of diffusers ? i got the same error :(

Which version does work?

I am using the latest version of diffuser https://github.com/huggingface/diffusers
version = "0.33.1"

Screenshot 2025-04-20 at 10.19.23 PM.png

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment