系统环境

Linux version 5.15.0-60-generic (buildd@lcy02-amd64-054) (gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023

安装显示卡驱动(Nvidia)

1
2
sudo apt-get update
ubuntu-drivers devices

选择系统推荐的nVidia驱动并安装。

1
2
3
4
5
6
7
8
9
10
11
12
13
  == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00002684sv00001043sd000088E2bc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-driver-535-server-open - distro non-free
driver : nvidia-driver-535-open - distro non-free
driver : nvidia-driver-525 - distro non-free
driver : nvidia-driver-545 - distro non-free
driver : nvidia-driver-535 - distro non-free recommended //选这个recommended
driver : nvidia-driver-545-open - distro non-free
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-525-open - distro non-free
driver : nvidia-driver-525-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
1
sudo apt install nvidia-driver-535

重启后确认nVidia驱动是否正常安装

1
2
nvidia-smi
nvcc --version

安装应用程序环境

1
2
3
4
5
6
sudo apt install git software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install python3.10-venv -y
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui && cd stable-diffusion-webui
python3.10 -m venv venv
bash webui.sh -f --xformers

安装openAI clip-vit-large-patch14模型

1
2
3
4
5
cd stable-diffusion-webui
mkdir openai
cd openai
git clone https://hf-mirror.com/openai/clip-vit-large-patch14 //这个是国内下载的镜像网站,下载模型也用这个

启动SD

1
/stable-diffusion-webui# venv/bin/python3.10 launch.py --port 9959 --listen --enable-insecure-extension-access --xformers