[Linux,AI绘画]搭建Stable-Diffusion

最近的AI绘画很火,我们也来搭建一个

在linux下安装Stable-Diffusion

1.首先我们下载或者克隆Stable-Diffusion-Webui[大概3MB]

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

2.更新apt/yum源,并安装python系列和git[大概600MB]

[可选]换为国内源

debian系

sudo sed -i s/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/ /etc/apt/sources.list

其他的发行版可以在 搜索

[正式]安装

debian系

sudo apt update && sudo apt install -y python3 python3-pip python3-venv git

redhat系

sudo yum makecache && sudo yum install -y python3 python3-pip python3-venv git

3.更换pypi源为国内源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

4.安装pypi依赖

pip install torch 
&& pip install torchvision 
&& pip install gfpgan 
&& pip install clip 
&& pip install opencv-python-headless

5.解压stable-diffusion-webui

6.下载模型

7.将模型复制进stable-diffsuion-webui-master/models/

sudo cp models.ckpt stable-diffusion-webui-master/models/

8.运行webui,安装最后的依赖

python3 launch.py --port 1234 --listen

9.浏览器输入地址加端口访问

10.开始你的做图吧! 

经验分享 程序员 微信小程序 职场和发展