Stable-Diffusion-v2.1: Optimized for Qualcomm Devices
Generates high resolution images from text prompts using a latent diffusion model. This model uses CLIP ViT-L/14 as text encoder, U-Net based latent denoising, and VAE based decoder to generate the final image.
This is based on the implementation of Stable-Diffusion-v2.1 found here. This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the Qualcomm® AI Hub Models library to export with custom configurations. More details on model performance across various devices, can be found here.
Qualcomm AI Hub Models uses Qualcomm AI Hub Workbench to compile, profile, and evaluate this model. Sign up to run these models on a hosted Qualcomm® device.
Deploy to Snapdragon X Elite NPU
Please follow the Stable Diffusion Windows App tutorial to quantize model with custom weights.
Quantize and Deploy Your Own Fine-Tuned Stable Diffusion
Please follow the Quantize Stable Diffusion tutorial to quantize model with custom weights.
Getting Started
There are two ways to deploy this model on your device:
Option 1: Download Pre-Exported Models
Below are pre-exported model assets ready for deployment.
| Runtime | Precision | Chipset | SDK Versions | Download |
|---|---|---|---|---|
| PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X2 Elite | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X Elite | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCM6690 | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS9075 | QAIRT 2.42, ONNX Runtime 1.25.0 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X2 Elite | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X Elite | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Gen 3 Mobile | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8550 (Proxy) | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8775P | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 7 Gen 4 Mobile | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA7255P | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCM6690 | QAIRT 2.45 | Download |
| QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS9075 | QAIRT 2.45 | Download |
For more device-specific assets and performance metrics, visit Stable-Diffusion-v2.1 on Qualcomm® AI Hub.
Option 2: Export with Custom Configurations
Use the Qualcomm® AI Hub Models Python library to compile and export the model with your own:
- Custom weights (e.g., fine-tuned checkpoints)
- Custom input shapes
- Target device and runtime configurations
This option is ideal if you need to customize the model beyond the default configuration provided here.
See our repository for Stable-Diffusion-v2.1 on GitHub for usage instructions.
Model Details
Model Type: Model_use_case.image_generation
Model Stats:
- Input: Text prompt to generate image
Performance Summary
| Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit |
|---|---|---|---|---|---|---|
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 4.617 ms | 0 - 10 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X2 Elite | 3.517 ms | 1 - 1 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X Elite | 7.464 ms | 418 - 418 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 5.913 ms | 0 - 12 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | 7.936 ms | 0 - 450 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 12.022 ms | 0 - 6 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 5.058 ms | 0 - 13 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS9075 | 7.403 ms | 0 - 3 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCM6690 | 82.576 ms | 1 - 10 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS7790 | 12.022 ms | 0 - 6 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS8750 | 5.058 ms | 0 - 13 MB | NPU |
| text_encoder | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS7181 | 7.464 ms | 418 - 418 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 4.834 ms | 0 - 10 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X2 Elite | 4.114 ms | 0 - 0 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X Elite | 7.868 ms | 0 - 0 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Gen 3 Mobile | 5.758 ms | 0 - 7 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8275 | 17.397 ms | 0 - 7 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8550 (Proxy) | 8.054 ms | 0 - 1 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8775P | 8.325 ms | 0 - 8 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8650P | 8.325 ms | 0 - 8 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8255P | 8.325 ms | 0 - 8 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 7 Gen 4 Mobile | 12.161 ms | 0 - 6 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 4.936 ms | 0 - 13 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS9075 | 8.041 ms | 0 - 2 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCM6690 | 78.475 ms | 0 - 6 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA7255P | 17.397 ms | 0 - 7 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS7790 | 12.161 ms | 0 - 6 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8750 | 4.936 ms | 0 - 13 MB | NPU |
| text_encoder | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS7181 | 7.868 ms | 0 - 0 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 69.141 ms | 0 - 9 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X2 Elite | 66.121 ms | 1 - 1 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X Elite | 158.134 ms | 842 - 842 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 111.843 ms | 0 - 12 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | 153.085 ms | 0 - 898 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 214.812 ms | 0 - 11 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 101.188 ms | 1 - 12 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS9075 | 148.723 ms | 0 - 3 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCM6690 | 2422.263 ms | 1 - 11 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS7790 | 214.812 ms | 0 - 11 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS8750 | 101.188 ms | 1 - 12 MB | NPU |
| unet | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS7181 | 158.134 ms | 842 - 842 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 64.775 ms | 0 - 8 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X2 Elite | 67.65 ms | 0 - 0 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X Elite | 157.657 ms | 1 - 1 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Gen 3 Mobile | 109.298 ms | 13 - 19 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8275 | 345.898 ms | 0 - 7 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8550 (Proxy) | 152.77 ms | 1 - 2 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8775P | 147.757 ms | 0 - 8 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8650P | 147.757 ms | 0 - 8 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8255P | 147.757 ms | 0 - 8 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 7 Gen 4 Mobile | 213.448 ms | 0 - 7 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 99.824 ms | 0 - 13 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS9075 | 147.299 ms | 0 - 2 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCM6690 | 2389.658 ms | 1 - 11 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA7255P | 345.898 ms | 0 - 7 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS7790 | 213.448 ms | 0 - 7 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8750 | 99.824 ms | 0 - 13 MB | NPU |
| unet | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS7181 | 157.657 ms | 1 - 1 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 132.66 ms | 3 - 13 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X2 Elite | 146.175 ms | 4 - 4 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® X Elite | 259.875 ms | 65 - 65 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Gen 3 Mobile | 197.765 ms | 4 - 10 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS8550 (Proxy) | 263.46 ms | 0 - 65 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 7 Gen 4 Mobile | 505.85 ms | 2 - 8 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 172.266 ms | 3 - 15 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS9075 | 246.565 ms | 3 - 6 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCM6690 | 6285.708 ms | 3 - 9 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS7790 | 505.85 ms | 2 - 8 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS8750 | 172.266 ms | 3 - 15 MB | NPU |
| vae | PRECOMPILED_QNN_ONNX | w8a16 | Qualcomm® QCS7181 | 259.875 ms | 65 - 65 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite Gen 5 Mobile | 123.45 ms | 0 - 10 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X2 Elite | 128.555 ms | 0 - 0 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® X Elite | 257.611 ms | 0 - 0 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Gen 3 Mobile | 195.024 ms | 1 - 7 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8275 | 712.921 ms | 0 - 10 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8550 (Proxy) | 262.583 ms | 1 - 2 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8775P | 244.518 ms | 0 - 9 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8650P | 244.518 ms | 0 - 9 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA8255P | 244.518 ms | 0 - 9 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 7 Gen 4 Mobile | 503.845 ms | 1 - 7 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Snapdragon® 8 Elite For Galaxy Mobile | 159.909 ms | 1 - 10 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS9075 | 241.974 ms | 0 - 3 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCM6690 | 6253.689 ms | 1 - 8 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® SA7255P | 712.921 ms | 0 - 10 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS7790 | 503.845 ms | 1 - 7 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS8750 | 159.909 ms | 1 - 10 MB | NPU |
| vae | QNN_CONTEXT_BINARY | w8a16 | Qualcomm® QCS7181 | 257.611 ms | 0 - 0 MB | NPU |
License
- The license for the original implementation of Stable-Diffusion-v2.1 can be found here.
References
Community
- Join our AI Hub Slack community to collaborate, post questions and learn more about on-device AI.
- For questions or feedback please reach out to us.
Usage and Limitations
This model may not be used for or in connection with any of the following applications:
- Accessing essential private and public services and benefits;
- Administration of justice and democratic processes;
- Assessing or recognizing the emotional state of a person;
- Biometric and biometrics-based systems, including categorization of persons based on sensitive characteristics;
- Education and vocational training;
- Employment and workers management;
- Exploitation of the vulnerabilities of persons resulting in harmful behavior;
- General purpose social scoring;
- Law enforcement;
- Management and operation of critical infrastructure;
- Migration, asylum and border control management;
- Predictive policing;
- Real-time remote biometric identification in public spaces;
- Recommender systems of social media platforms;
- Scraping of facial images (from the internet or otherwise); and/or
- Subliminal manipulation
