Issue is that ZImagePipeline is not in the standard diffusers package
issue is that ZImagePipeline is not in the standard diffusers package - it's a custom pipeline that comes with the model. We need to use DiffusionPipeline with trust_remote_code=True to load the custom pipeline
❌ Error generating image: module diffusers has no attribute ZImagePipeline
ImportError: cannot import name 'ZImagePipeline' from 'diffusers'
Try installing from source:
pip install git+https://github.com/huggingface/diffusers.git -U
It should be installed from source, We have updated the README.
It should be installed from source, We have updated the README.
I tried it but it doesnt work.
We've mentioned it in the github repo previously, now we also mention it in this repo
also huggingface-hub>=0.34.0,<1.0 is required, why?
Had to downgrade
Can someone check this https://github.com/PierrunoYT/Z-Image-Pinokio
The ones who don't want ComfyUI will check
It doesnt work. So this is needed...
The installation instructions aren't full, I also had to downgrade HuggingFace Hub
The installation instructions aren't full, I also had to downgrade HuggingFace Hub
In general, huggingface_hub is quite flexible. If you are facing strict version conflicts between diffusers and huggingface_hub, or if you just want to bypass the runtime version check, downloading the weights manually is a good workaround.
However, regarding the ImportError, you must install diffusers from source, otherwise from diffusers import ZImagePipeline will never work regardless of where the weights are stored.
Here is a workflow that might help you bypass the hub versioning issue while ensuring the pipeline loads:
Install diffusers from source (Mandatory for ZImagePipeline):
pip install git+https://github.com/huggingface/diffusers.git -UDownload weights locally (To avoid Hub version issues):
huggingface-cli download --resume-download Tongyi-MAI/Z-Image-Turbo --local-dir "./Z-Image-Turbo"Run Inference:
import torch # This import requires the source installation from step 1 from diffusers import ZImagePipeline # Load from local path pipe = ZImagePipeline.from_pretrained( "./Z-Image-Turbo", torch_dtype=torch.bfloat16, low_cpu_mem_usage=False, ) pipe.to("cuda")
- Download weights locally (To avoid Hub version issues):
huggingface-cli download --resume-download Tongyi-MAI/Z-Image-Turbo --local-dir "./Z-Image-Turbo"
Should be hf download --resume-download Tongyi-MAI/Z-Image-Turbo --local-dir "./Z-Image-Turbo instead because huggingface-cli is deprecated
