Instructions to use Tongyi-MAI/Z-Image-Turbo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Tongyi-MAI/Z-Image-Turbo 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-Turbo", 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 Settings
- Draw Things
- DiffusionBee
about the model size compared to flux
#12
by Yang18 - opened
Thanks for your excellent work. I am confused that why is the file size of your 6B model similar to that of the Flux.1 12B model (both transformers are around 24GB)?
Hi! Thanks for your interest. We uploaded the weights in fp32 precision, so each parameter costs 4 bytes. But this would not affect inference, as we typically convert the model to 16-bit precision before inference.
import torch
from diffusers import ZImagePipeline
pipe = ZImagePipeline.from_pretrained(
"Tongyi-MAI/Z-Image-Turbo",
torch_dtype=torch.bfloat16, # this line
low_cpu_mem_usage=False,
)
Got it. Thanks for the quick response! Looking forward to more of your excellent work~
Yang18 changed discussion status to closed