install stable diffusion webui on ubuntu 22.04
Environment
- CPU: Xeon E5-2696 v4
- GPU: Nvidia GTX 1660 (6G)
Nvidia GPU Prepare
Install Nvidia Drivers
|
|
Disable/blacklist Nouveau nvidia driver
First step is to Blacklist Nvidia nouveau driver. Open up terminal and enter the following commands:
|
|
Confirm the content of the newly created modeprobe file blacklist-nvidia-nouveau.conf
:
|
|
Enter the following Linux command to update kernel initramfs:
sudo update-initramfs -u
Last step is to reboot your system:
sudo reboot +0
Install CUDA
Install CUDA 11.5 that is provided from Ubuntu 22.04 official repository.
apt update
apt install nvidia-cuda-toolkit
|
|
Download Stable Diffusion models
Go to HuggingFace or Civitai to find a model.
- Realistic style models
- Stable Diffusion, the original model published by CompVis and StabilityAI.
- Chilloutmix
- Deliberate
suggest start from “Anything” model if want to draw anime artworks.
- Anime style models
Install Stable Diffusion WebUI
install python, wget, git
sudo apt install python3 python3-pip python3-virtualenv wget git
# configure git to use a proxy
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
cat ~/.gitconfig
install Anaconda
Download MiniConda Script
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Install MiniConda3 on Ubuntu 22.04
chmod +x ./Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
Hit the Enter key to start the installation process. Soon, the installer will ask to accept the License, press q, and then type Yes to accept it.
|
|
Create a virtual environment of Python 3.10.10
conda create --name sdwebui python=3.10.10
clone Stable Diffusion WebUI repository
1.Clone the repository of Stable Diffusion WebUI
cd ~
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ./stable-diffusion-webui
2.Move .ckpt
models to stable-diffusion-webui
mv ~/anything-v4.5-pruned.ckpt ~/stable-diffusion-webui/models/Stable-diffusion/
3.Enter the virtual enviroment
conda activate sdwebui
4.If want to activate virtual environment in a bash script, add these on the top of webui-user.sh
eval "$(conda shell.bash hook)"
conda activate sdwebui
launch Stable Diffusion WebUI
- If the VRAM of GPU is lower than 4GB, add:
COMMANDLINE_ARGS=--medvram --opt-split-attention
- If your PC has RAM lower than 8GB, add:
COMMANDLINE_ARGS=--lowvram --opt-split-attention
You could also add--listen
so you can access the WebUI from other PC on the same network. Or add –share to generate a public Gradio link for accessing WebUI while deploying SD WebUI to servers.
Run webui.sh, it will install all the dependencies. Then a link should pop up:
./webui.sh --lowvram --opt-split-attention --listen
how to update Stable Diffusion WebUI
1.Get current branch
git rev-parse --short HEAD
2.Pull latest files
git pull
3.If something is broken after updating, roll back to the previous branch
git checkout "branch"
How to use Stable Diffusion WebUI
prompts
Use Prompts
and Ngative Prompts
to tell AI what to draw.
See Vodly Artist name and Danbooru tags for choosing prompts.
For example, to draw Jeanne from Fate/Grand Order, we type the name of the character and characteristics of her body in the prompt fields.
jeanne d'arc from fate grand order, girl, (best quality), (masterpiece), (high detail), ((full face)), sharp, ((looking at viewer)), ((detailed pupils)), (thick thighs), (((full body))), (large breasts), vagina, nude, nipples
Then type negative prompts.
lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts,signature, watermark, username, blurry, artist name
Some interesting plugins
|
|