The young lady opened the way
Since last year, AIGC has slowly become popular, and recently with the release of ChatGPT4 and Baidu's Wenyan Yixin, AIGC's popularity has reached a new height.
Today I will use Stable Diffusion to experience the power of AIGC and feel the power of AIGC.
Stable Diffusion is a text-to-image potential diffusion model created by researchers and engineers at CompVis, Stability AI and LAION. It was trained using 512x512 images from a subset of the LAION-5B database. With this model, any image including faces can be generated, and since there are open-source pre-trained models, we can also run it on our own machines. The beautiful little sister above is automatically generated through it.
What is AIGC
AIGC is AI Generated Content, refers to the use of artificial intelligence technology to generate content, AIGC is also considered to be a new type of content production after UGC, PGC, AI painting, AI writing, etc. belong to the branch of AIGC. For AIGC, 2022 is considered an amazing year for its development.
The recent popularity of ChatGPT and Wenyan Yixin both belong to the category of AIGC.
Set up the Stable Diffusion environment
Environment preparation
Hardware system: I use a MacBook Pro 2015, and both Windows and Linux are fine.
Software environment: Git, required to download various source code from GitHub. I use 3.9.13 for python and use Anaconda to manage the python environment.
Download the code
The source code of stable-diffusion-webui can be searched directly from GitHub, and the search ranking is the first.
The source code for WebUI
Download the model
The source code alone can't run, it's just an empty shell, and we still need to inject soul into it. This soul is a variety of models, and different models are different souls. The size of the model file is generally large, and the download will be a bit slow.
Download the model on civitai
Run the code
At this time, you can start running the code, just enter the webUI root directory and execute ./webui.sh.
If nothing else, there is a high probability that there will be an accident at this time.
In this process, there will be various pits, and only by wading through these pits one by one can it be successfully operated.
However, I have already traveled through many pits, so let's not talk about it here, let's talk about it later, just pretend to run it successfully.
What it looks like after a successful startup
After successful operation, the URL of the page that can be accessed will be printed. If the port is not specified in the startup parameters, the page port will be automatically increased when there is a conflict.
Run Stable Diffusion
First of all, visit the address just after the SD is started: http://127.0.0.1:7861, you can enter the following page:
WebUI's interface
As can be seen from the page, SD supports many functions, today we will mainly talk about the function of txt2img, SD other powerful functions will not be expanded.
The page can be divided into four main areas:
1. Upper left corner: prompt area, used to enter the description of the picture, SD generates the picture according to this.
2. Lower left corner: parameter adjustment area, you can modify various parameters of the generated picture.
3. Upper right corner: operation area, here are various operation buttons, such as generate buttons.
4. Lower right corner: picture preview area, the generated picture will be displayed here.
Generate the first image
SD is running and can't wait to generate a picture. Excited heart, trembling hands, tap the generate button.
Image generation
Ah, it's so slow, it takes ten or twenty minutes to generate an image. Computer performance is like this, you can only wait slowly, a dozen points is not too long, after all, it took several hours to install and explore.
Finally, when the run was completed, it turned out to be such a thing for me [Decay].
First picture
Where is my beautiful little sister [declining], this is not what I want.
Use a live-action base model and a Lora model
The above picture is a direct copy of someone else's prompt, and there is almost no modification, and the generated effect is naturally not ideal. At this time, we need to download the better live models and Lora models trained by others.
The bottom model determines the overall style of the plot, and the Lora model is a lightweight model scheme that can train specific submodels on the basis of the base model.
Hurry up to civitai to find a more suitable base model and Lora model. After importing the model, run it again to see the final result.
Pretty little sister
Pretty little sister
This time it worked well, that's what I want [Aimu]!
Problems encountered in practice
Now that I have seen the final effect, let's take a look at what problems I have encountered in the practice process, after all, the whole process took me several hours to solve various problems.
pip installation software is particularly slow
This problem is actually very common, people who use Python have basically encountered, the solution is also very simple, find a domestic mirror can be, I chose Tsinghua's mirror.
Configuration of pip
Clone code on GitHub is particularly slow
Although the github wall has not been removed in China, but the access is not very stable, I am by adding ghproxy.com in front of the access address, as shown below:
GitHub acceleration
All places involving code clones can be accelerated by this method.
open_clip installation was unsuccessful
Other software installations are relatively smooth, but there are problems when installing open_clip:
open_clip error reported
Finally, the relevant information is checked on the Internet, which is solved through the pip install open_clip_torch.
end
Today, I experienced the ability of AIGC through DS and also felt the power of AIGC.
In the future, the work of writing code, drawing, writing, writing songs and other content generation work is estimated to be completed by AI, and humans only need to provide good prompts to guide AI to work, will there be a profession called AI prompt designer?
Finally, paste all the beautiful photos of the beautiful young lady generated today:
Pretty little sister
Pretty little sister