Stable Diffusion WebGPU demo is an innovative web-based application that lets users generate stunning images using the create-react-app framework. It provides a seamless user experience with a user-friendly interface where every step is made simple and intuitive.

To get started, users need to have JavaScript enabled and use the latest version of Chrome. Additionally, users need to enable the “Experimental WebAssembly” and “Experimental WebAssembly JavaScript Promise Integration (JSPI)” flags in their browser settings. For Linux/Mac users, it’s important to run Chrome with the “–enable-dawn-features=allow_unsafe_apis” flag. On Windows, running Chrome with the “–enable-dawn-features=allow_unsafe_apis,use_dxc” flag is necessary.

The application utilizes cutting-edge technology like WebGPU to perform a series of inference steps to generate high-quality images. Each step takes approximately 1 minute, and an additional 10 seconds are needed for the VAE decoder to generate the image. It’s essential to note that having the DevTools open may slow down the process.

For optimal results, we recommend a minimum of 20 steps, but for demonstration purposes, 3 steps are sufficient. The model files are cached, so users won’t have to download them repeatedly, saving time and resources.

If users encounter any issues, our FAQ section provides troubleshooting guidance. From solving protobuf parsing errors to dealing with insufficient RAM, we’ve got you covered. We’ve made the application accessible to everyone by providing a repository on GitHub. You can now run Stable Diffusion WebGPU demo locally and have full control over your image generation process.

While the application operates on a GPU, it’s important to know that the webgpu implementation in onnxruntime is still in its early stages. Consequently, some operations may be incomplete, resulting in data being continuously transferred between the CPU and GPU, impacting performance. However, as the implementation progresses, improvements will be made to enhance efficiency and speed.

Though multi-threading is not currently supported, the developer has proposed spec changes and engine patches to address this limitation. Additionally, the creation of 64-bit memory with SharedArrayBuffer through WebAssembly is restricted. To tackle this, the developer plans to implement a “memory64” flag and make the necessary engine patches once accepted.

We strive to provide users with the best experience by actively maintaining and supporting our applications. For advanced users working with large language models, we offer a patched version of onnxruntime. This allows compatibility with transformers.js and enables the use of up to ~4GB weights to run big LLMs. While we can’t guarantee compatibility in all cases, we are continuously working to improve functionality and reliability.

To contribute to the community, the developer plans to submit a pull request to the onnxruntime repository. This demonstrates our commitment to progress and collaboration, ensuring that users benefit from the latest advancements in the field.

Stable Diffusion WebGPU demo is an exciting application that combines the power of web-based image generation with advanced AI technology. Whether you’re a beginner or an expert, this application offers a unique and engaging experience that opens up a world of possibilities for creative image generation.

Other Tools