实用指南:stable diffusion搭建指南

项目地址:https://github.com/AUTOMATIC1111/stable-diffusion-webui

在腾讯云算力服务器最新执行启动命令

nohup python3 -u launch.py --skip-prepare-environment --xformers --listen --enable-insecure-extension-access --port=6889 --api > /var/log/sd_service.log &

nohup python3 -u launch.py --skip-prepare-environment --xformers --listen --enable-insecure-extension-access --port=6889 --api --api-log --no-gradio-queue --enable-console-prompts > /var/log/sd_service.log &

conda管理python环境,建议3.9以上版本

#查看环境

conda info --env

#创建环境

conda create --name python310 python=3.10

#激活环境

conda activate python310

安装其他依赖

apt install --no-install-recommends google-perftools

pip install xformers

启用自动安装服务

bash webui.sh -f --port 8080 --listen --xformers --enable-insecure-extension-access --api

放在前台运行,又能检测到错误,和实时看到日志

apt-get install screen

创建一个新会话

screen -S sd

会到指定会话

screen -r sd

其他问题:

  1. 如果遇到git下载请求问题:

#代理设置

git config --global http.proxy 42.193.142.230:1090

#取消代理

git config --global --unset http.proxy

  1. 遇到 'type' object is not subscriptable 问题

python语法不支持问题,需要升级到3.9以上

3.遇到http访问外网问题

vim ~/.bashrc

alias setproxy="export ALL_PROXY=http://42.193.142.230:1090"
alias unsetproxy="unset ALL_PROXY"

source ~/.bashrc

然后执行

setproxy

4.遇到切换模型一直loading ,并且报Error: Connection errored out

vim ~/.bashrc

export COMMANDLINE_ARGS="--no-gradio-queue"

source ~/.bashrc

  1. Cannot locate TCMalloc

apt install --no-install-recommends google-perftools

6.No module 'xformers'. Proceeding without it.

pip install xformers

7.AssertionError: extension access disabed because of commandline flags

启动命令增加 --enable-insecure-extension-access

8.支持api接口

启动命令增加 --api

模型下载位置

从模型下载网站下载相关的模型文件,上传到相应目录即可,最著名最多模型的也就是c站,https://civitai.com/

1.checkpoints (大模型,sd的主模型)

/stable-diffusion-webui/stable-diffusion-webui/models/Stable-diffusion

因为webui.sh会下载一个新项目,所以会多一级目录

2.lora(微调模型,基于大模型做一些参数微调)

/stable-diffusion-webui/stable-diffusion-webui/models/Lora

参考链接:

[Stable Diffusion ]webui部署(Linux) https://blog.51cto.com/holy2010/6940654

【Stable Diffusion】安装过程中常见报错解决方法 https://blog.csdn.net/Bankcary/article/details/131237002

stable diffusion webui 启动参数详解 https://blog.csdn.net/glovenone/article/details/132408230

Stable Diffusion模型存放位置及种类介绍 https://zhuanlan.zhihu.com/p/643709254

47个高质量的 Stable Diffusion 常用模型推荐 https://www.uisdc.com/47-stable-diffusion-models

ubuntu部署stable-diffusion-webui https://blog.wuzuxi.com/218.html

Stable Diffusion入门(十二):制作会说话图片 | SadTalker https://zhuanlan.zhihu.com/p/638639336

Stable Diffusion系列课程上:安装、提示词入门、常用模型(checkpoint、embedding、LORA)、放大算法、局部重绘、常用插件https://zhuanlan.zhihu.com/p/642592246?utm_id=0

posted @ 2026-01-08 21:50  clnchanpin  阅读(5)  评论(0)    收藏  举报