Qwen-Image VAE (ONNX & WebGPU)
This repository contains standalone ONNX exports of the Qwen-Image VAE (Variational Autoencoder) decoupled from the full diffusion pipeline.
Designed for high-fidelity spatial image compression (12× spatial downsampling with 16 channels) and high-speed in-browser WebGPU / WASM inference via ONNX Runtime Web.
Model Files
| File | Precision | File Size | Description |
|---|---|---|---|
encoder_fp16.onnx |
FP16 | ~101 MB | 2D Spatial Encoder (maps RGB [1, 3, H, W] to latent [1, 16, H/8, W/8]) |
decoder_fp16.onnx |
FP16 | ~137 MB | 2D Spatial Decoder (reconstructs RGB [1, 3, H, W] from latent) |
encoder.onnx |
FP32 | ~203 MB | Full precision 2D Spatial Encoder |
decoder.onnx |
FP32 | ~273 MB | Full precision 2D Spatial Decoder |
Direct CDN URLs for WebGPU & In-Browser Inference
Because Hugging Face Hub serves all raw file endpoints with Access-Control-Allow-Origin: *, web applications can fetch and execute these models directly in WebGPU shaders without any backend server:
import * as ort from 'onnxruntime-web';
const opts = {{ executionProviders: ['webgpu'] }};
// Load Encoder directly from Hugging Face CDN
const encSession = await ort.InferenceSession.create(
'https://huggingface.co/sampatil1010/qwen-image-vae-onnx/resolve/main/encoder_fp16.onnx',
opts
);
// Load Decoder directly from Hugging Face CDN
const decSession = await ort.InferenceSession.create(
'https://huggingface.co/sampatil1010/qwen-image-vae-onnx/resolve/main/decoder_fp16.onnx',
opts
);
Latent Space Specification
- Spatial Compression: $8 \times 8$ pixel patch per latent token.
- Channels: 16 continuous latent dimensions.
- Dynamic Compression Ratio: $\approx 12.0\times$ raw RGB data reduction.
- Reconstruction Quality: PSNR $\ge 36.5\text{ dB}$, SSIM $\ge 0.995$ on high-resolution text and complex documents.