The generation of art with artificial intelligence is at an unprecedented peak. Discord users are enjoying Midjourney to the fullest, but DALL-E 2 and Stable Diffusion are not far behind, as we have seen in this impromptu duel of algorithms. So, what's next? A good possibility is to move to the next phase and install one of the models locally, and Stable Diffusion presents itself as the ideal candidate. A recent tutorial explains the process step by step, and although it demands a lot of patience at first, it works better than expected.
Artificial intelligence and art. The beginnings of their relationship were shy, experimental. Rigid interpretations, many errors, a technical barrier too high for the end user. However, all that has changed: Today we can tell an algorithm to generate fantastic landscapes using the keyboard, and with a couple of minimal adjustments, the results are completely different.
Stable Diffusion is just one of several models that make this practice possible, but thanks to its open profile we can install a local copy, as long as our hardware is up to the task. The "Ultimate GUI Retard Guide" describes the exact process to install Stable Diffusion on your PC with a graphical interface in the browser, and today we decided to put it to the test.
Installing Stable Diffusion to generate art on your computer
- First warning: If you do not have Nvidia hardware, stop here. Stable Diffusion requires CUDA. AMD users can try with this guide, but there are no guarantees.
- Download the 1.4 model of Stable Diffusion. I recommend using the magnet link to obtain the file with BitTorrent. It's 4 gigabytes, be patient.
- Download the Stable Diffusion repository, and extract the contents into a folder.
- Download the repository for the Stable Diffusion WebUI, and extract the contents into another folder.
- If Windows warns about the need to overwrite files from this point on, always confirm yes.
- Move the scripts with .py extension (there are three files) from the folder stable-diffusion-webui to stable-difussion-main/scripts
- Move the file webui.yaml to the folder stable-diffusion-main/configs/webui
- Move everything else in stable-diffusion-webui to the inside of stable-diffusion-main
- Rename the file sd-v1-4.ckpt to model.ckpt, and move it to stable-diffusion-main/models/ldm/stable-diffusion-v1
- Edit the file environment.yaml located in stable-diffusion-main, and modify the field name on the first line from ldm to ldo
- Download version 3 of Miniconda
- Install Miniconda in its default location, for all users (All Users)
- Uncheck the option "Register Miniconda as the system Python 3.9"
- Finally, double-click on webui.cmd in stable-diffusion-main
- Wait. The script will download a large amount of additional dependencies (in the order of 3 GB), and will take between 20 and 30 minutes to complete the task. If Windows needs to run additional processes and asks for authorization, allow it to continue. Patience, patience, patience.
- Once you see the legend localhost:7860 on the console, enter that address in your favorite browser.
- If everything goes well, the Stable Diffusion interface will appear. Good job!
17 steps decompressed and half an hour later, we can start our experiments. The tutorial also includes details to solve problems (for example, receiving only green squares on GTX 16XX cards), optimizing the model on hardware with 4 GB of VRAM, and instructions to add GFPGAN and ESRGAN (face correction and upscaling respectively). However, those modules further increase VRAM usage, and are already available in other applications (like waifu2x-vulkan). To close, we share some of the samples that Stable Diffusion created in the last session. Good luck!
Access the tutorial: Click here