Summary of how to install the definitive version 'Stable Diffusion web UI (AUTOMATIC 1111 version)' that allows you to easily run the image generation AI 'Stable Diffusion' on a 4GB GPU and various functions such as learning your own patterns on Google Colabo and Windows.
(Updated 2022/09/22 17:52) One of the contributors (development contributors) of '
GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI
https://github.com/AUTOMATIC1111/stable-diffusion-webui
◆Table of contents
1: What the AUTOMATIC1111 version Stable Diffusion web UI can do and support
2: Run with Google Colab (NVIDIA GPU not required)
3: Run on Windows (NVIDIA GPU required)
3-1: Installing Python
3-2: Installing Git
3-3: Installing CUDA
3-4: Installing and running Stable Diffusion web UI
3-5: How to update Stable Diffusion web UI
◆1: What the AUTOMATIC1111 version Stable Diffusion web UI can do and support
The following is what this 'AUTOMATIC1111 version Stable Diffusion web UI' can do and support . It is characterized by incorporating all standard functions.
・Outpainting: Background expansion
・Inpainting: Redrawing a specific part
・Prompt matrix: Creating a comparison image that shows the difference between the presence and absence of a specific prompt
・Stable Diffusion upscale: Implementation of 'txt2imghd' that applies RealESRGAN that scales up cleanly from 512 x 512, which gives the best results.
・Attention: You can specify the part you want to particularly emphasize in the prompt by surrounding it with (), and the part you want to weaken with [].
・Loopback: Improve the quality of the picture by automatically repeating the process of creating an image created from a base image using 'img2img' as a base image.
・X/Y plot: Create a comparison image of what happens when you change the parameter values
・Textual Inversion:Generate images with patterns based on learning data prepared by yourself
・Resizing: Resizing under complex conditions
・Sampling method selection: Selection of sampling algorithm (change of pattern)
・Interrupt: Stopping during image generation
・4GB videocard support: Generates 512×512 even in an environment with 4GB of video memory
・GFPGAN: Make faces that tend to be asymmetrical natural.
・Saving: Specify a specific folder to save & output generation conditions as a CSV file
・Correct seeds for batches: Shift the 'seed value' of elements that specify composition etc. by 1
・Loading: Cut loading to make it a little faster
・Prompt validation: Warn if the prompt is too long
・Png info: embed prompts and parameters in PNG images
・User scripts: Can be changed or extended with user scripts
◆2: Run with Google Colab (NVIDIA GPU not required)
An NVIDIA GPU is required to run 'Stable Diffusion', but not all PCs are equipped with an NVIDIA GPU. However, by running the AUTOMATIC1111 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 page below.
StableDiffusionUI-Voldemort.ipynb - Colaboratory
https://colab.research.google.com/drive/1Iy-xW9t1-OQWhb0hNxueGij8phCyluOh
Then the page that has already been written will be displayed like this.
When you move the mouse cursor to the beginning of each line, a play button will be displayed, so just press this play button one by one.
When you press the first play button, a dialog like this will appear, but click 'Run as is'.
The execution details will then be displayed below the code. When a green check mark appears to the left of the play button, the code execution is complete and you can move on to the next code.
When you press the play button in the code 'import os', a dialog will appear at the bottom of the browser informing you that the session has crashed and restarted, and the play button will turn red. No completion mark is displayed, but this is expected behavior as the comment says '#This will crash Colab', so if a dialog saying 'The session crashed for an unknown reason' appears, close it. OK to move on to the next step.
'!pip install -r requirements.txt' takes a little time because there are two Git installations: 'Stable Diffusion' and 'Taming Transformer'.
An error occurred when installing 'tensorboard', but there seems to be no problem even if you don't worry about it. There is no need to press the 'RESTART RUNTIME' button; you can proceed to the next step when the completion mark appears.
The next thing you need to do is an input field that says ``Insert text here'' on the right side. You need to enter the token from the AI-related community site 'Hugging Face' here.
A Hugging Face account is required to issue tokens. Please refer to the article below for instructions on how to create an account and issue tokens.
In addition, if you fail to agree to the 'Access repository' twice here, you will not be able to obtain access privileges to Hugging Face, and a 403 will be returned to the HTTP request, resulting in the learning model file hosted on Hugging Face. cannot be downloaded.
If configured properly, the 3.97GB 'model.ckpt' file will be downloaded.
All you have to do is press the play button for each chord in the same way. Although some error messages are displayed, the installation is progressing.
Finally, when the generator UI is displayed, the installation is complete. When you access the URL shown after 'Running on public URL'...
AUTOMATIC1111 version Stable Diffusion web UI has started.
The image generation time was just over 10 seconds when Sampling Steps was 20, and over 30 seconds when Sampling Steps was 120, which was not much different from running it locally.
If you use this method of using Google Colab, you can use 'Stable Diffusion' even on PCs that do not have NVIDIA GPUs. However, once the Google Colab runtime is disconnected, it becomes unusable, so while it is convenient if you only use it a few times in a short period of time, you cannot continue to use it for a long period of time.
By the way, while trying to create it several times, there were times when the play button turned red and stopped when the code started with the last 'import sys'. Unlike the 'import os' section, no error should normally occur here.
In this example, there are roughly two things related to 'GFPGAN' and 'model.ckpt'.
Regarding 'model.ckpt', it is not found in its original location '/content/stable-diffusion-webui/repositories/stable-diffusion/models/ldm/stable-diffusion-v1/', so it is displayed on the left side of the screen. When I clicked the folder icon in the menu and checked the configuration, I found that there was no 'stable-diffusion-v1' folder in the 'ldm' folder, and that 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. This error didn't occur during another attempt, and I wasn't sure if it was due to timing or what. Since then, the code has been updated, and this type of error is almost no longer seen.
◆3: Runs 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
Run the downloaded 'python-3.10.7-amd64.exe'.
Check 'Add Python 3.10 to PATH' at the bottom and click 'Install Now'.
Click 'Close'.
◆Installing Git
Go to the download page of Git official website and click 'Click here to download'.
Git - Downloading Package
Run the downloaded 'Git-2.37.3-64-bit.exe'.
Proceed without changing the installation options. Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Next'.
Click 'Install'.
After installation, uncheck 'View Release Notes' and click 'Finish'.
◆3-3: Installing CUDA
Download 'CUDA Tool 11.3' from NVIDIA's developer site. The link below is the installer download page for Windows/64bit. The file size is 2.7GB because we chose the type that includes all files rather than the type that downloads files during installation.
CUDA Toolkit 11.3 Downloads | NVIDIA Developer
Click 'Download (2.7GB)' at the bottom right.
Run the downloaded 'cuda-11.3.0-465.89_win10.exe'.
Click 'Agree and continue'.
Click 'Next'.
Check the checkbox and click 'Next'.
Click 'Next'.
Click 'Close'.
◆3-4 Installing and running “Stable Diffusion web UI”
Run Command Prompt as administrator.
After navigating to the drive you want to install at the command prompt, type ' git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ' to clone the AUTOMATIC1111 version Stable Diffusion web UI repository.
It is successful if a folder called 'stable-diffusion-webui' is created 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.
Next, download the learning model file from Hugging Face. Please refer to the article below for instructions.
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.
The Stable Diffusion model also has derivatives such as
Next, download '
Once done, run the 'webui-user.bat' file in the Stable Diffusion web UI folder.
A command prompt will open and some string will appear. 'Running on local URL: http://127.0.0.1:7860' appears, so when you open this URL in the browser...
Stable Diffusion web UI has started.
◆3-5 How to update “Stable Diffusion web UI”
To update the Stable Diffusion web UI, right-click the 'stable-diffusion-webui' folder and select 'Git Bash Here'.
If you type ' git pull ' and run it, the contents of the folder will be updated automatically.
Related Posts:
in Review, Software, Web Application, , Posted by logc_nt