SD-Turbo, ONNX fp16 for ONNX Runtime Web (WebGPU)
Powered by Stability AI
This is an ONNX conversion of stabilityai/sd-turbo
(revision b261bac6fd2cf515557d5d0707481eafa0485ec2). It's made to run on the device in
ONNX Runtime Web with the WebGPU execution provider. Sovereign Browser
uses it to generate images locally.
Licence
- These files are a Derivative Work of SD-Turbo. They are distributed under the
Stability AI Community License Agreement (
LICENSE.md, "Last Updated: July 5, 2024"). - Sovereign Browser uses SD-Turbo under that licence for research and non-commercial purposes.
- Read
NOTICE.txtfor the required attribution and a description of what was changed. - Use must follow Stability AI's Acceptable Use Policy: https://stability.ai/use-policy
- Under Section 4(b) of the licence, outputs must not be used to create or improve any foundational generative AI model.
- This conversion is not affiliated with or endorsed by Stability AI.
Files
| File | Bytes | SHA-256 |
|---|---|---|
text_encoder/model.onnx |
681,265,617 | 7880e1995a97511ebefeb36706601be7e79906eec2fecec38c20e193e4edd4a6 |
unet/model.onnx |
1,733,823,332 | 42414ff7d8eeaeb302686405aaf9806b8015055c3d569fd0e133093eed257ddb |
vae_decoder/model.onnx |
99,138,996 | b0c03b84a8fb59a58d9e683e6f617bbd8e9c0ea9be894f32f452451173e834a9 |
- The tokenizer, scheduler and config files are unmodified copies from the source revision.
SHA256SUMSlists every file except itself. To check a download, runshasum -a 256 -c SHA256SUMS.
Inputs and outputs
All three graphs use fp16 weights and float32 inputs and outputs.
| Model | Inputs | Outputs |
|---|---|---|
| text_encoder | input_ids int32 [batch, 77] |
last_hidden_state [batch, 77, 1024], pooler_output |
| unet | sample [batch, 4, 64, 64], timestep int64 [1], encoder_hidden_states [batch, 77, 1024] |
out_sample (epsilon) |
| vae_decoder | latent_sample [batch, 4, 64, 64] (latents รท 0.18215) |
sample [batch, 3, 512, 512], range โ1..1 |
Scheduler: EulerDiscrete, scaled_linear betas, "trailing" timestep spacing. One step is recommended.
How it was made
Toolchain: Python 3.12.13, torch 2.8.0, diffusers 0.35.2, transformers 4.57.1, onnx 1.19.1, onnxruntime 1.23.2. Every package was pinned by version and SHA-256.
Export: PyTorch's TorchScript exporter (
torch.onnx.export,dynamo=False), opset 17, eager attention, constant folding on.fp16: ONNX Runtime's
float16.convert_float_to_float16withkeep_io_types=Trueand its default op block list. Constant nodes were moved to initializers, and the nodes were put back into topological order.Accuracy: compared on ONNX Runtime CPU with the original PyTorch model in float32.
Model Relative L2 error text encoder 9.0e-4 UNet 3.2e-5 VAE decoder 4.1e-5 Speed: measured on an Apple M4 with Electron 38 and ONNX Runtime Web 1.31.1 (WebGPU), at 512 ร 512.
Measure Result One step about 3.0 s Four steps about 6.4 s Network requests while generating 0
Limitations
- SD-Turbo makes 512 ร 512 images of modest quality.
- It can produce wrong, biased or unsafe content. Apps should add their own safety checks.
- The safety checker isn't included here.
Model tree for Sandy231/sd-turbo-onnx-webgpu-fp16
Base model
stabilityai/sd-turbo