Stable Diffusion Webgpu
Description
Experience stable image generation with Stable Diffusion WebGPU demo. This web-based app uses the create-react-app framework, JavaScript, and the latest version of Chrome. With a user-friendly interface and cached model files, generating images is a breeze. Troubleshoot with the FAQ section, and check out the source code on GitHub for local runs. Note that the webgpu implementation in onnxruntime is still evolving, causing some incomplete operations and impacting performance.
About Stable Diffusion Webgpu
Welcome to Stable Diffusion WebGPU demo!
Our web-based application allows you to create stunning images using the create-react-app framework. To access the application, make sure you have JavaScript enabled and use the latest version of Chrome. You will also need to enable the "Experimental WebAssembly" and "Experimental WebAssembly JavaScript Promise Integration (JSPI)" flags.
When generating an image, our application performs a series of inference steps. Each step takes approximately 1 minute, and then an additional 10 seconds for the VAE decoder to generate the image. Keep in mind that having the DevTools open can slow down the process by approximately 2 times.
Our image generation model, UNET, runs exclusively on the CPU due to its better performance and accurate results compared to the GPU. For acceptable results, we recommend a minimum of 20 steps. However, for the purpose of demonstration, 3 steps will suffice. You'll be happy to know that our model files are cached, eliminating the need for repeated downloads.
Our user-friendly interface lets you easily load the model, run the image generation process, and view the result. To address any specific issues you may encounter, we have an FAQ section available with troubleshooting guidance.
Please note that while our application runs on a GPU, the webgpu implementation in onnxruntime is still in its early stage. This means that some operations are incomplete, resulting in continuous data transfer between the CPU and GPU, which affects performance. At this time, multi-threading is not supported, and limitations in WebAssembly prevent the creation of 64-bit memory with SharedArrayBuffer. Rest assured, our developer is working on addressing these issues through proposed spec changes and engine patches.
If you're interested in exploring the source code for Stable Diffusion WebGPU demo, it's available on GitHub, allowing you to run it locally. We also provide a patched version of onnxruntime, enabling the use of large language models with transformers.js. However, please note that its reliability in all scenarios is not guaranteed. Our developer has plans to submit a pull request to the onnxruntime repository to further enhance the application.