Image generation AI 'Stable Diffusion' works even with 4 GB GPU OK & various functions such as learning your own pattern can be easily operated on Google Colabo or Windows Definitive edition 'Stable Diffusion web UI (AUTOMATIC 1111 version)' installation method Summary
Stable Diffusion web UI ', which is one of the execution environments for easily using the image generation AI 'Stable Diffusion'. A certain AUTOMATIC1111 is developing a Stable Diffusion web UI (AUTOMATIC1111 version) with the same name, but not a fork, but with 'all functions'.
(Updated 2022/09/22 17:52) I am one of the contributors (development contributors) of '
GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable diffusion web UI
1: What you can do and what you can do with the AUTOMATIC1111 version of Stable Diffusion web UI
2: Run with Google Colab (No NVIDIA GPU required)
3: Run on Windows (need NVIDIA GPU)
3-1: Installing Python
3-2: Installing Git
3-3: Install CUDA
3-4: Install and run Stable Diffusion web UI
3-5: How to update Stable Diffusion web UI
◆ 1: What you can do and what you can do with AUTOMATIC 1111 version Stable Diffusion web UI
What you can do and what you can do with this 'AUTOMATIC 1111 version Stable Diffusion web UI' is as follows. It features all standard functions.
・Outpainting: background expansion
・Inpainting: Redrawing specific parts
・Prompt matrix: Create a comparison image that shows the difference with or without a specific prompt
Stable Diffusion upscale: Implementation of ``txt2imghd'' that applies RealESRGAN that scales cleanly from 512x512 for best results
・Attention: You can specify the part you want to emphasize in the prompt with () and the part you want to weaken with .
・Loopback: Automatically repeats creation based on the image created from the base image with 'img2img' to improve the quality of the picture
・X/Y plot: Create a comparison image of what happens when the parameter values are changed
・Textual Inversion:Image generation with patterns based on self-prepared learning data
・Resizing: Resizing under complex conditions
・Sampling method selection: Selection of sampling algorithm (change of picture)
・Interrupt: Stopping during image generation
・4GB videocard support: Generate 512 x 512 even in an environment with 4GB of video memory
・GFPGAN: Make a face that tends to be left-right asymmetric look natural
・Saving: Specify a specific folder to save and output the creation conditions as a CSV file
・ Correct seeds for batches: Shift the 'seed value' of the element that specifies the composition etc. by 1
・Loading: Cut loading to make it a little faster
Prompt validation: Warn if prompt is too long
・Png info: Embed prompts and parameters in PNG images
・User scripts: Can be modified and extended with user scripts
◆ 2: Run with Google Colab (No NVIDIA GPU required)
An NVIDIA GPU is required to run 'Stable Diffusion', but not all PCs have an NVIDIA GPU. However, by running the AUTOMATIC 1111 version of Stable Diffusion web UI on 'Google Colab', you can use 'Stable Diffusion' in any environment.
First, log in to your Google account and access the following page.
StableDiffusionUI-Voldemort.ipynb - Colaboratory
Then, like this, the already written page is displayed.
When you move the mouse cursor to the beginning of each line, a play button will be displayed, so if you press this play button in order, it is OK.
When you press the first play button, such a dialog will be displayed, but click 'Run as it is'.
Then, the execution contents are displayed staggered under the code. When you see a green check mark to the left of the play button, the code execution is complete, so let's run the next code.
At the code 'import os', when you press the play button, a dialog box appears at the bottom of the browser indicating that the session has crashed and restarted, and the play button turns red. The completion mark is not displayed, but as the comment says '#This will crash Colab', it is expected behavior, so if the dialog 'The session crashed for an unknown reason.' Click OK to proceed.
The '!pip install -r requirements.txt' will take a while because there are two Git installations, 'Stable Diffusion' and 'Taming Transformer'.
An error occurred when installing 'tensorboard', but it seems to be no problem even if you don't care about it. You don't need to press the 'RESTART RUNTIME' button, you can proceed when the completion mark appears.
The next thing you need to work on is the input field 'Insert text here' on the right side. Here you need to enter the token of the AI related community site 'Hugging Face'.
Summary of how to use image generation AI ``Stable Diffusion'' even on low-spec PCs for free and without waiting time - GIGAZINE
A Hugging Face account is required to issue tokens. Please refer to the following article for how to create an account and issue a token.
If you do not agree to the 'Access repository' twice here, you will not be able to access Hugging Face, and a 403 will be returned to the HTTP request, and the learning model file hosted by Hugging Face cannot be downloaded.
If you can set it properly, the 3.97GB 'model.ckpt' file will be downloaded.
Then just press the play button for each chord in the same way. Some kind of error message is coming out, but the installation is progressing.
Finally, when the generator UI is displayed, the installation is complete. When you access the URL shown behind 'Running on public URL' ......
AUTOMATIC1111 version Stable Diffusion web UI started.
The image generation time is a little over 10 seconds when Sampling Steps is 20, and a little over 30 seconds when Sampling Steps is 120, which is almost the same as running locally.
If you use this Google Colab method, you can use 'Stable Diffusion' even on a PC that does not have an NVIDIA GPU. However, it cannot be used if the Google Colab runtime is disconnected, so it is convenient if you only use it a few times in a short period of time, but you cannot continue to use it for a long time.
By the way, while trying to create it several times, the code starting with the last 'import sys' sometimes caused the play button to turn red and stop. Unlike the 'import os' part, an error should not occur here.
In this example, there are roughly two related to 'GFPGAN' and 'model.ckpt'.
As for 'model.ckpt', it is not found in the original location '/content/stable-diffusion-webui/repositories/stable-diffusion/models/ldm/stable-diffusion-v1/', so When I clicked the folder icon in the menu and checked the configuration, there was no 'stable-diffusion-v1' folder in the 'ldm' folder, and the 'model.ckpt' file was placed directly under 'content' in the first place. I understand.
Therefore, when I manually created the folder and moved the 'model.ckpt' file, the installation proceeded. I didn't get this error on another try and I'm not sure if it was due to timing or what. Since then, the code side has also been updated, and this kind of error has almost disappeared.
◆ 3: Run on Windows (NVIDIA GPU required)
◆3-1: Installing Python
Download the latest version (3.10.7 at the time of article creation) from the Python official website. Click the download button below.
Download Python | Python.org
Execute the downloaded 'python-3.10.7-amd64.exe'.
Check 'Add Python 3.10 to PATH' at the bottom and click 'Install Now'.
Go to the download page of the Git official website and click 'Click here to download'.
Git - Downloading Package
Execute the downloaded 'Git-2.37.3-64-bit.exe'.
Proceed without changing any installation options. Click 'Next'.
After installation, uncheck 'View Release Notes' and click 'Finish'.
◆3-3: Installing CUDA
Download 'CUDA Tool 11.3' on the NVIDIA developer site. The following link is the installer download page for Windows 64bit. The file size is 2.7GB because the type that contains all files is selected instead of the type that downloads files during installation.
CUDA Toolkit 11.3 Downloads | NVIDIA Developer
Click 'Download (2.7 GB)' in the lower right.
Execute the downloaded 'cuda-11.3.0-465.89_win10.exe'.
Click 'Agree and continue'.
Check the checkbox and click 'Next'.
◆ 3-4 Install and run 'Stable Diffusion web UI'
Run Command Prompt as administrator.
After moving to the drive you want to install at the command prompt, enter ' git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ' to clone the AUTOMATIC1111 version Stable Diffusion web UI repository.
Successful if a folder called 'stable-diffusion-webui' is generated directly under the specified drive. If you have not moved the drive, a folder will be created in 'C:\Users\[your Windows login name]'.
The contents of the folder look like this.
Summary of how to introduce ``Stable Diffusion web UI'' that can build the execution environment of image generation AI ``Stable Diffusion'' on Windows for free - GIGAZINE
Next, download the learning model file from Hugging Face. Please refer to the following article for the procedure.
Rename the downloaded 'sd-v1-4.ckpt' to 'model.ckpt' and put it in 'models' in the Stable Diffusion web UI folder you expanded earlier.
Waifu-Diffusion , etc., which are derived, and they are all put together in this 'models' folder.
Stable Diffusion models include
GFPGAN ' from GitHub and put it in the Stable Diffusion web UI folder. The latest version at the time of article creation is v1.4 .
Then download '
Once done, run the 'webui-user.bat' file in the Stable Diffusion web UI folder.
A command prompt will open and a string will appear. 'Running on local URL: http://127.0.0.1:7860' will appear, so if you open this URL in a browser ......
The Stable Diffusion web UI has started.
◆ 3-5 How to update 'Stable Diffusion web UI'
To update the Stable Diffusion web UI, right click on the 'stable-diffusion-webui' folder and select 'Git Bash Here'.
If you enter ' git pull ' and execute it, the contents of the folder will be automatically updated.
Basic usage of ``Stable Diffusion web UI (AUTOMATIC 1111 version)'' that can easily use ``GFPGAN'' that can clean the face that tends to collapse with image generation AI ``Stable Diffusion''-GIGAZINE
in Review, Software, Web Application, Posted by logc_nt