Z Image Turbo Installation
To install Z Image Turbo, you'll need to use the latest version of diffusers. The Z Image Turbo installation process requires Python 3.8+ and PyTorch. Here's how to get Z Image Turbo up and running:
pip install git+https://github.com/huggingface/diffusersZ Image Turbo Code Example
Once Z Image Turbo is installed, you can start generating images immediately. This Z Image Turbo code example demonstrates the basic usage pattern. The Z Image Turbo API is intuitive and developer-friendly, making integration seamless.
import torch
from diffusers import ZImagePipeline
# Load Z Image Turbo
pipe = ZImagePipeline.from_pretrained(
"Tongyi-MAI/Z-Image-Turbo",
torch_dtype=torch.bfloat16,
)
pipe.to("cuda")
# Generate with Z Image Turbo
image = pipe(
prompt="Your prompt here",
height=1024,
width=1024,
num_inference_steps=9,
guidance_scale=0.0,
).images[0]Z Image Turbo Requirements
Before using Z Image Turbo, ensure your system meets the Z Image Turbo requirements. Z Image Turbo works best with CUDA-enabled GPUs, though CPU inference is also supported. For optimal Z Image Turbo performance, we recommend using bfloat16 precision and enabling Flash Attention when available.