Consumer hardware had long outgrown its demand to the point where, aside for gamers, there was really no reason to use technology beyond the intel i5. AI changed that: now consumers are running software that requires compute not normally met by personal computers. Chipmakers are already pushing out new products to make client side AI a possibility for developers, but for now you can make do with just a Ryzen 7 and some sort of GPU.
The launch of WebGPU gave hardware-accelerated applications access to the most powerful distribution tool in history: the internet. And any casual web surfer can run AI software locally, via google search.
WebDiffuser is typescript implementation of a bare bones image diffuser intended as an experiment in client side ML. It contains a small torch-like library of gpu-kernels and a very basic workload optimizer.
-
WebGPU torch implementation
-
Diffusions Modules
-
Performance improvements
-
Support for Stable Diffusion Models
- WebGPU is not yet standard across all browsers. This was tested in Google Chrome and Brave
- This was tested on AMD graphics but should work on NVIDIA as well. If you do not have a GPU things will break
Install all package dependencies
npm install
Then run the following to start a dev build
npm run serve
Select the model you want to run; open dev tools (ctrl-shift-i) if you want to track progress.
The torch library I use is a fork of webgpu-torch by praeclarum The model is based on this implementation The pytorch source code By boy shiv for his Data Science Textbook
I didn't know anything about AI when I started this project so huge thanks to everyone who helped along the way :)