Z-Image-Turbo
This repository provides an optimized ONNX version of Tongyi-MAI/Z-Image-Turbo, specifically tailored for efficient browser execution via WebNN and WebGPU using ONNX Runtime Web.
π Runtime Pipeline
The end-to-end inference flow runs sequentially across the ONNX sub-models under onnx/ per image generation:
Inference Flow
π§© Sub-model Components
| Stage | ONNX Model Artifact | Precision | Key Role |
|---|---|---|---|
| 1. Text Encoding | text_encoder_model_q4f16.onnx |
Q4F16 | Encodes text prompts into conditional embeddings |
| 2. Denoising | transformer_model_q4f16.onnx |
Q4F16 | Predicts noise latents across diffusion iterations |
scheduler_step_model_f16.onnx |
FP16 | Computes denoised latents per step | |
| 3. Decoding | vae_pre_process_model_f16.onnx |
FP16 | Scales and shifts latents for decoding |
vae_decoder_model_f16.onnx |
FP16 | Reconstructs pixel-space RGB image from latents | |
| 4. Safety | sc_prep_model_f16.onnx |
FP16 | Normalizes and pre-processes the image for the safety checker |
safety_checker_model_f16.onnx |
FP16 | Inspects processed image features to ensure content safety |
π οΈ Export & Reproduction
Instructions and scripts for exporting and optimizing the ONNX models from the original PyTorch weights can be found in the model_exporter/README.md.
π Live Demo
Experience the model running in the browser:
- Interactive Demo: WebNN Developer Preview - Z-Image-Turbo
π Credits
- Original PyTorch Model: Tongyi-MAI/Z-Image-Turbo
- Web Runtime: ONNX Runtime Web / WebNN Developer Preview