【Stable Difussion】一键部署

一、安装

1、github项目地址:

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

2、新建conda环境

conda create -n sdxl python=3.10
注:python版本应该大于3.10

3、切换至conda环境,启动项目

切换环境

conda activate sdxl

在空的项目目录下执行:

wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh

启动:

1、cd stable-diffusion-webui
2、bash webui.sh 

可能出现的错误:

错误一:Cannot locate TCMalloc (improves CPU memory usage)

解决方法:安装 libgoogle-perftools4 和 libtcmalloc-minimal4 库。

sudo apt-get install libgoogle-perftools4 libtcmalloc-minimal4 -y

错误二: This script must not be launched as root, aborting…

解决方法:运行 bash webui.sh -f

4、git 下载失败

打开你的stable-diffusion主目录,找到如图所示的launch.py文件 
找到  def prepare_enviroment():
在每个  https://github.com/  开头的链接前面添加   https://ghproxy.com/  
例如:
	https://ghproxy.com/https://github.com/ 

5、显示安装torch失败

1、检查显卡使用,停掉不用的服务,至少保证显卡余量10g以上
2、安装离线包   pip执行本地安装,先到朋友torch官网中找到对应的版本,获取到下载 cuda版本(cu)、python版本(cp)、还有torch版本(2.0.1)、torchvision(0.15.2)版本,获取到对应的下载链接后,可在Linux下执行 
wget https://........

6、卡在安装Installing requirements

网络问题,可以查看stable-diffusion-webui/requirements 下载对应的离线包 安装后再执行wenui.sh

7、报错 openai/clip-vit-large-patch14

报错:OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-large-patch14' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.
解决:手动下载   需要翻墙   https://huggingface.co/openai/clip-vit-large-patch14/tree/main
下载文件为:
1、config.json
2、flax_model.msgpack
3、merges.txt
4、preprocessor_config.json
5、pytorch_model.bin
6、special_tokens_map.json
7、tokenizer.json
8、tokenizer_config.json
9、vocab.json
在项目目录下创建(stable-diffusion-webui)
mkdir -p openai/clip-vit-large-patch14

把以上九个文件放到新文件夹下

7、不要忘记修改restart.sh中的VAE路径

二、运维

1、模型位置

模型挂载到:目录文件/stable-diffusion-webui/models/Stable-diffusion/

2、风格位置

SDXL文件夹挂载到: 目录文件/stable-diffusion-webui/models/Lora/

3、VAE挂载

sdxl_vae.safetensors
文件夹挂载到: 目录文件/stable-diffusion-webui/models/VAE/

3、项目启动参数

--api  # 启动画图接口
--vae-path  #添加vae模式,切换模型 
--server-name #指定ip地址
--port #指定端口
例子:
bash webui.sh --api --vae-path /disk/sdxl/stable-diffusion-webui/models/VAE/sdxl_vae.safetensors --server-name ${host} --port ${port} >> sdxl.log 2>&1 &

4、重启项目

conda activate sdxl
cd 到  /disk/sdxl/
执行 sh restart.sh  

5、日志文件存放地址

/disk/sdxl/sdxl.log

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值