--- license: apache-2.0 tags: - onnx - webnn - webgpu - text-to-image - z-image-turbo --- # Z-Image-Turbo This repository provides an optimized ONNX version of **[Tongyi-MAI/Z-Image-Turbo](https://huggingface.co/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
Z Image Turbo Pipeline
### 🧩 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](model_exporter/README.md). ## 🌐 Live Demo Experience the model running in the browser: * **Interactive Demo**: [WebNN Developer Preview - Z-Image-Turbo](https://microsoft.github.io/webnn-developer-preview/demos/z-image-turbo/) ## 📑 Credits * **Original PyTorch Model**: [Tongyi-MAI/Z-Image-Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) * **Web Runtime**: [ONNX Runtime Web](https://github.com/microsoft/onnxruntime) / [WebNN Developer Preview](https://github.com/microsoft/webnn-developer-preview)