Instructions to use Tongyi-MAI/Z-Image with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Tongyi-MAI/Z-Image with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Tongyi-MAI/Z-Image", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Rainbow/garbage output on RTX 5090 with diffusers
I'm getting rainbow/garbage output when running the official Z-Image example with diffusers on an RTX 5090 (Blackwell), Windows. Same code from the model card works in terms of running, but the decoded image is wrong.
Setup
- GPU: NVIDIA GeForce RTX 5090
- OS: Windows
- Python: 3.12, in a venv (not global)
- PyTorch: 2.7.1+cu128
- diffusers: 0.37.0.dev0
What I'm running
The exact example from the model card (prompt, ZImagePipeline.from_pretrained("Tongyi-MAI/Z-Image", torch_dtype=torch.bfloat16), then pipe(...) with num_inference_steps=30, guidance_scale=4, cfg_normalization=False, height=512, width=512). Image saves without error but looks like rainbow/noise.
What I've already tried
- Triton / Sage Attention: Not installed in this env.
importlib.util.find_spec("triton")and"sageattention"are bothNone. So the pipeline is using default PyTorch attention. - TORCHAO_DISABLE_INTMM=1: Set before running; no change. Still get
torchao.kernel.intmmwarning and rainbow output. - fp32: With
torch_dtype=torch.float32the output is the same rainbow junk. - With a step callback: NaNs first appear at denoising step 0 (first transformer forward). So the issue is the Z-Image transformer on RTX 5090, not the VAE or quantization.
- Z-Image Turbo (local, same 5090 setup) runs fine; the issue appears specific to the base Z-Image model.
Question
Is Z-Image (base) with the official diffusers pipeline known to work on RTX 5090 / Blackwell? If yes, what environment (PyTorch/diffusers versions, dtype, any env vars or flags) are you using? If there’s a known workaround (e.g. disable a backend, use a specific diffusers version), I’d appreciate a pointer.
Thanks.
Can you try with CUDA 13
After spending half the day on this, it turns out the repo just hadn't downloaded correctly. File sizes and everything looked complete, but it was corrupted and redownloading fixed the issue. False alarm, sorry!
This thread is resolved: the root cause was a corrupted download. Redownloading the model fixed the rainbow/garbage output. Not a pipeline bug.