该项目是一个针对Stable Diffusion模型的浏览器操作界面,基于Gradio。
环境: 在恒源云上租的服务器,操作系统:Ubuntu、显卡:A4000-16G。恒源云官网链接
项目的Readme.md让我们用webui.sh
配置项目,但是各种Bug。。。只能自己弄了。
# 更新一下pip
pip install --upgrade pip
# 克隆项目
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
# 从huggingface官网里下载别人训练好的ckpt模型,放到models/Stable-diffusion目录下面
# 推荐模型: https://huggingface.co/Envvi/Inkpunk-Diffusion
# https://huggingface.co/elontrump/nice/tree/main
# 在"恒源云"中,模型上传建议使用oss命令工具,具体操作参考官方文档
# 接着, 进入项目
cd stable-diffusion-webui/
# 直接运行launch.py文件,各种依赖包会自动安装
# --share参数表示Gradio会提供的一个公网地址用来访问,--xformers用来显存优化、加速推理
# 可以用python launch.py -h查看参数
python launch.py --share --xformers
效果如下图:
访问上面的public URL
报错1:
File "/usr/local/lib/python3.8/dist-packages/cv2/gapi/__init__.py", line 301, in <module>
cv.gapi.wip.GStreamerPipeline = cv.gapi_wip_gst_GStreamerPipeline
AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import)
解决:直接修改/usr/local/lib/python3.8/dist-packages/cv2/gapi/__init__.py文件,把cv.gapi.wip.GStreamerPipeline = cv.gapi_wip_gst_GStreamerPipeline 这行注释掉。
报错2:
Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps:
1. Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64
2. Rename the downloaded file to: frpc_linux_amd64_v0.2
3. Move the file to this location: /usr/local/lib/python3.11/site-packages/gradio
解决:根据提示来就行,先下好frpc_linux_amd64,重命名为frpc_linux_amd64_v0.2,并传到/usr/local/lib/python3.11/site-packages/gradio。
报错3:
Could not create share link. Please check your internet connection or our status page: https://status.gradio.app.
解决:给frpc_linux_amd64_v0.2文件加可执行权限
chmod +x /usr/local/lib/python3.11/site-packages/gradio/frpc_linux_amd64_v0.2
报错4:
File "/usr/local/lib/python3.11/dist-packages/xformers/ops/fmha/dispatch.py", line 63, in _run_priority_list
raise NotImplementedError(msg)
NotImplementedError: No operator found for `memory_efficient_attention_forward` with inputs:
解决:不去设置--xformers
python launch.py --share
脸部修复插件ADetailer安装:
重启,添加 --enable-insecure-extension-access 参数
python launch.py --share --enable-insecure-extension-access
stable diffusion免费尝试网站