My current workstation uses a Windows 11 OS and it has a Nvidia RTX 3090 GPU. In the past, I’ve enabled WSL (Windows Subsystem for Linux) on this workstation. It will be amazing to be able to run StableDiffusion under this setup for me. I spent some time and it worked without too much husle. Here is how I achieved this.
The WSL is Windows’s new vritual system that can run Ubuntu natively along side with Windows. The keyword here is the Linux is run as a subsystem (AKA natively). This allows it to access all the hardwares on this machine without significant overhead like other virtual machines. Once WSL is enabled, you can verify it has access to the Nvidia card by running:
nvidia-smi
Now the question is how can we run and visualize StableDiffusion. Luciky StableDiffusion provides the Web UI. The web UI, as its name suggested, uses a webserver to manage a lot of things. This means the backend code can run on the WSL, and the UI can be opened in the Windows web browser. This is amazing. That’s it once it’s running, open a webbrowser, and go to: 127.0.01:7860. We are all set. In addition to running the Stable Diffusion model, we can also install all sorts of extentions from the UI. The WSL window now is our terminal. To modify code, we can fire up the Visual Stuido Code on Windows and directly access the WSL Ubuntu directory. What a beautify setup, best of both world (Windows, Ubuntu, StableDiffusion).
sudo apt install wget git python3 python3-venv
bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)
./webui.sh