Skip to content

MAC Ultra pipe.load_lora raise an error "AttributeError: QwenImageDiT has no attribute diffusion_model" #224

@donaldxu

Description

@donaldxu

diffsynth-engine==0.6.0

source code

import gradio as gr
from diffsynth_engine import fetch_model, QwenImagePipeline, QwenImagePipelineConfig

import torch

model_name = "Qwen/Qwen-Image-2512/"
device = "mps" # Mac 使用 MPS (Metal Performance Shaders)
torch_dtype = torch.bfloat16

print("Loading model...")

transformer_files = [f'Qwen/Qwen-Image-2512/transformer/diffusion_pytorch_model-0000{x}-of-00009.safetensors' for x in range(1,10)]
encoder_files = [f'Qwen/Qwen-Image-2512/text_encoder/model-0000{x}-of-00004.safetensors' for x in range(1,5)]
vae_files = [f'Qwen/Qwen-Image-2512/vae/diffusion_pytorch_model.safetensors']
config = QwenImagePipelineConfig.basic_config(
model_path = transformer_files,
encoder_path= encoder_files,
vae_path= vae_files,
offload_mode="cpu_offload",
device = device,
)
pipe = QwenImagePipeline.from_pretrained(
config,
)
lora_file = 'Qwen-Image-2512-Turbo-LoRA/Wuli-Qwen-Image-2512-Turbo-LoRA-4steps-V1.0-bf16.safetensors'
pipe.load_lora(
path=lora_file,
scale=1.0,
fused=True,
)
........

Error

File "/Users/abc/models/main.py", line 35, in
pipe.load_lora(
File "/opt/anaconda3/lib/python3.12/site-packages/diffsynth_engine/pipelines/base.py", line 79, in load_lora
self.load_loras([(path, scale)], fused, save_original_weight)
File "/opt/anaconda3/lib/python3.12/site-packages/diffsynth_engine/pipelines/qwen_image.py", line 269, in load_loras
super().load_loras(lora_list, fused, save_original_weight)
File "/opt/anaconda3/lib/python3.12/site-packages/diffsynth_engine/pipelines/base.py", line 76, in load_loras
model.load_loras(lora_args, fused=fused)
File "/opt/anaconda3/lib/python3.12/site-packages/diffsynth_engine/models/base.py", line 44, in load_loras
module = self.get_submodule(key)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 710, in get_submodule
raise AttributeError(
AttributeError: QwenImageDiT has no attribute diffusion_model

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions