ubuntu 下安装原生 stable diffusion webui 一键脚本

在腾讯云 T4 和 Autodl 3090 上测试通过,请手动复制粘贴按顺序执行即可
# ENV1
# GPU::NVIDIA T4
# OS::Ubuntu Server 18.04 LTS 64位

# ENV2
# GPU::GeForce RTX 3090
# OS::Ubuntu Server 20.04 LTS 64位

# update ubuntu package 安装依赖包
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get build-dep gcc
sudo apt-get install build-essential
gcc--version

# install conda 安装 conda
# latest:https://docs.conda.io/projects/conda/en/stable/user-guide/install/linux.html
wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh
bash Anaconda3-2022.10-Linux-x86_64.sh 
# 回车&&yes
#
bash
#先激活base环境
source ~/anaconda3/bin/activate
(base) $
# 初始化
(base) $ conda init

# create env 创建环境
conda create -n webui python=3.10
conda activate webui
pip install xformers
# show env 查看环境
conda info -e
# delete env 删除环境
# conda remoave -n webui --all

git pull --rebase
pip install -r requirements.txt


# download sd 下载 webui
# git clone https://ghproxy.com/https://github.com/AUTOMATIC1111/stable-diffusion-webui # 连不上用代理
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
# accelerate pytorch  torch 下载过慢可使用腾讯源
# pip install -i https://mirrors.cloud.tencent.com/pypi/simple torch
# 阿里:http://mirrors.aliyun.com/pypi/simple/
# 豆瓣:http://pypi.douban.com/simple/
# 清华:https://pypi.tuna.tsinghua.edu.cn/simple/
# 中科大:https://pypi.mirrors.ustc.edu.cn/simple/
# 中科大:http://pypi.mirrors.ustc.edu.cn/simple/
# install depend 安装依赖
python launch.py

mkdir models/Lora
# 常用 model
## SD1.5
wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt -P models/Stable-diffusion/
## pastel-Mix
wget https://civitai.com/api/download/models/6297 -O models/Stable-diffusion/pastelMixStylizedAnime_pastelMixPrunedFP16.safetensors 
## MIX-Pro-V3
wget https://civitai.com/api/download/models/8511 -O models/Stable-diffusion/mixProV3_v3.safetensors
## chilloutmix
wget https://civitai.com/api/download/models/11745 -O models/Stable-diffusion/chilloutmix_NiPrunedFp32Fix.safetensors
## Cetus-Mix
wget https://civitai.com/api/download/models/18496 -O models/Stable-diffusion/cetusMix_cetusVersion3.safetensors
## MeinaMix
wget https://civitai.com/api/download/models/16925 -O  models/Stable-diffusion/meinamix_meinaV7.safetensors
## Counterfeit-V2.5
wget https://civitai.com/api/download/models/7425 -O models/Stable-diffusion/CounterfeitV25_25.safetensors
wget https://civitai.com/api/download/models/4279 -O models/Stable-diffusion/ligneClaireAnime_v1.safetensors
wget https://civitai.com/api/download/models/8365 -O models/Stable-diffusion/anythingAndEverything_anythingAndEverythingVer.safetensors

# VAE
wget https://civitai.com/api/download/models/6297?type=VAE -O models/VAE/pastel-waifu-diffusion.vae.pt
wget https://civitai.com/api/download/models/8511?type=VAE -O models/VAE/kl-f8-anime2.ckpt

# Lora
## moxin
wget https://civitai.com/api/download/models/14856 -O models/Lora/Moxin_10.safetensors
## fashion-gir
wget https://civitai.com/api/download/models/18070 -O models/Lora/fashionGirl_v47.safetensors
## line
wget https://civitai.com/api/download/models/19075 -O models/Lora/animeLineartStyle_v20Offset.safetensors
## eyes
wget https://civitai.com/api/download/models/6433 -O models/Lora/eyeLora_eyesV10.safetensors

wget https://civitai.com/api/download/models/19859 -O models/Lora/animeTarotCardArtStyleLora_v20Offset.safetensors

# start
python webui.py --port 6006 --share --listen --enable-insecure-extension-access --disable-safe-unpickle --xformers 

# install extensions
# install controlnet
# download controlnet models 下载 controlnet 模型
wget https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_canny-fp16.safetensors -P extensions/sd-webui-controlnet/models/
wget https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_depth-fp16.safetensors -P extensions/sd-webui-controlnet/models/
wget https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_openpose-fp16.safetensors -P extensions/sd-webui-controlnet/models/
wget https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_hed-fp16.safetensors -P extensions/sd-webui-controlnet/models/
wget https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_mlsd-fp16.safetensors -P extensions/sd-webui-controlnet/models/

你可能感兴趣的:(ubuntu,python,pytorch)