深圳哪里网站制作,百度 wordpress react,万维网站建设,中昌国际建设集团网站文章目录 整体安装步骤windows10安装stable diffusion环境要求安装步骤注意事项参考博客其他事项安装显卡驱动安装cuda卸载cuda安装对应版本pytorch安装git上的python包QA linux安装stable diffusion安装anaconda安装cudagit 加速配置虚拟环境挂载oss#xff08;optional… 文章目录 整体安装步骤windows10安装stable diffusion环境要求安装步骤注意事项参考博客其他事项安装显卡驱动安装cuda卸载cuda安装对应版本pytorch安装git上的python包QA linux安装stable diffusion安装anaconda安装cudagit 加速配置虚拟环境挂载ossoptional端口开放启动服务controlnet显卡使用监控插件安装参考文章 脚本安装stable diffusionstable diffusion教程modelstutorialprompt reference 整体安装步骤
GPU环境安装NVIDIA驱动和cuda注意版本建议安装cuda11.7方便后续使用xformer配置git环境git拉取stable diffusion项目配置python虚拟环境安装GPU版torch安装虚拟环境依赖包项目本身的requirement及子项目依赖下载模型文件启动stable diffusion
windows10安装stable diffusion
环境要求
独立显卡最低配置4GB显存基本配置6GB显存推荐配置8GB显存以上。显存越大越好。显存越大可以生成的图片分辨率就越大。内存内存16G或者以上。磁盘至少10GB。
安装步骤
安装Python3.10.6安装git下载sd项目AUTOMATIC1111下载模型文件例如stable-diffusion-v1-5 Stable Diffusion的官方模型V1.5版本一共提供了两个模型一个3.97GB另一个是7.17GB。绘画版3.97GB模型推荐正常绘图的人使用无需训练自己的模型。训练版7.17GB模型如果您想以该模型为基础训练自己的模型。那么下载该模型可以得到更好的效果。 运行webui-user.bat脚本
注意事项
cuda版本与显卡驱动版本适配pytorch的gpu版本与cuda版本对应 脚本中默认会装就是比较慢耐心等待就行自己下载对应版本wheel文件安装搜索2.0.1cu118https://download.pytorch.org/whl/torch/可能会失败见issuehttps://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/1742 提前下载GitHub项目GFPGAN、CLIP、open_clip之后需要安装到Python虚拟环境中 python setup.py install 可能失败。可以提前cd到对应项目中使用pip install -r requirements.txt安装依赖包。 提前下载GitHub项目stable-diffusion-stability-ai、taming-transformers、k-diffusion、CodeFormer、BLIP之后需要cp到项目的repositories路径中
参考博客
https://stable-diffusion-art.com/install-windows/https://aituts.com/stable-diffusion-on-windows-automatic1111/
其他事项
安装显卡驱动
https://www.volcengine.com/docs/6419/69858
安装cuda
cuda版本与显卡驱动对照表 https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
要安装的显卡驱动是所以对应的cuda版本应该是 CUDA 12.0.x 、12.1.x等
安装成功后可以在cmd使用nvcc -V查看cuda版本使用nsmi
好像需要安装cuda11.8版本 下载链接https://developer.nvidia.com/cuda-12-1-0-download-archive?target_osWindowstarget_archx86_64target_version10target_typeexe_local
检查环境
python -m torch.utils.collect_env卸载cuda
cuda 和 cudnn 库的卸载与安装https://zhuanlan.zhihu.com/p/102966512
安装对应版本pytorch
在以下网址搜索2.0.1cu118 https://download.pytorch.org/whl/torch/ 其中cu118对应刚刚安装的cuda11.8版本
安装git上的python包
cd path to CLIP
# python setup.py install --user
python setup.py install
QA
stable diffusion报错RuntimeError: “LayerNormKernelImpl” not implem
解决方法运行命令修改为./webui.sh --precision full --no-half
在webui-user.bat中添加命令行参数 set COMMANDLINE_ARGS–skip-torch-cuda-test --precision full --no-half
AssertionError: extension access disabled because of command line flags
What’s happening is that, since you’re not running on localhost and everyone in the whole wide world can in theory access your Web UI, you need to explicitly enable extensions.
解决方法adding the --enable-insecure-extension-access flag
linux安装stable diffusion 简单版可查看之前的博客【AIGC】阿里云ecs部署stable diffusion 安装anaconda
安装Python、wget、git sudo apt install python3 python3-pip python3-virtualenv wget git
安装前置依赖 sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6
下载anaconda wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
创建Python 3.10.6的虚拟环境 conda create --name sdwebui python3.10.6
安装cuda
osubuntu2004 archx86_64 wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb sudo dpkg -i cuda-keyring_1.0-1_all.deb sudo apt update sudo apt install cuda-11-8
git 加速
开启加速 export http_proxyhttp://172.181.217.43:12798 export https_proxyhttp://172.181.217.43:12798 关闭加速 unset http_proxy unset https_proxy
【todo注意关闭配置】https://blog.csdn.net/zhiboqingyun/article/details/123912058
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
配置虚拟环境
启动虚拟环境 conda activate sdwebui
如果想要于bash script自动以conda启动虚拟环境可以把这二行加入至webui-user.sh顶端 eval “$(conda shell.bash hook)” conda activate sdwebui
下载模型 wget -nc -P ~/stable-diffusion-webui/models/Stable-diffusion https://huggingface.co/andite/anything-v4.0/resolve/main/anything-v4.5-pruned.safetensors -O anything-v4.5-pruned.safetensors
首次启动 ./webui.sh
./webui.sh --xformers --skip-install --enable-insecure-extension-access
挂载ossoptional
https://help.aliyun.com/document_detail/153892.html?spma2c4g.153893.0.0.1d877f1fHkYVYt
端口开放
https://www.bilibili.com/read/cv23060248
启动服务时需要添加 --listen参数 ./webui.sh --listen
sed -i ‘s/can_run_as_root0/can_run_as_root1/g’ webui.sh ./webui.sh --no-download-sd-model --xformers
启动后的一些权限问题
sudo chown -R root stable-diffusion-webui sudo chgrp -R root stable-diffusion-webui
服务地址http://xxx.xxx.xxx.xxx:7860/
启动服务
sudo ./webui.sh --listen --skip-install --enable-insecure-extension-access
controlnet
https://github.com/Mikubill/sd-webui-controlnet/issues/1399
Package cairo was not found in the pkg-config search path. Perhaps you should add the directory containing cairo.pc’ to the PKG_CONFIG_PATH environment variable No package ‘cairo’ found ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
sudo apt install libcairo2-dev
I fixed itby this way: run command below on linux sudo apt install libcairo2-dev install svglib package manually or relaunch webui pip install svglib
显卡使用监控
watch -n 1 nvidia-smi
插件安装 抠图插件安装https://zhuanlan.zhihu.com/p/632888046
参考文章
查看Linux服务器配置|是否有GPU以及GPU信息https://blog.csdn.net/qq_41725313/article/details/123784429
安装至Linuxhttps://ivonblog.com/posts/stable-diffusion-webui-manuals/zh-cn/installation/linux-installation/
安装驱动https://ivonblog.com/posts/ubuntu-install-nvidia-drivers/
安装驱动阿里云官方文档https://help.aliyun.com/document_detail/163824.htm?spma2c4g.298150.0.0.1e0b5355t3jXPh#concept-ecy-qrz-wgb
脚本安装stable diffusion
# git配置
git config --global http.postBuffer 524288000
git config --global https.postBuffer 524288000
git config --global core.compression -1
git config --global http.sslVerify false# 拉取stable diffusion
cd ~
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd ~/stable-diffusion-webui
git checkout 89f9faa63388756314e8a1d96cf86bf5e0663045# 配置python环境
conda create -y --name sdwebui python3.10.6
source activate sdwebui
python -m venv venv
source venv/bin/activate # conda activate sdwebui 可能会失败
# source venv/Scripts/activate # for win10 git bash# 安装GPU版torch
pip install torch2.0.0cu117 torchvision0.15.0cu117 --extra-index-url https://download.pytorch.org/whl/cu117
pip install xformers0.0.17# python github环境包
mkdir tmp_envs
cd tmp_envs
git config --global http.sslVerify false # 加上以防断连
git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN git checkout 8d2447a2d918f8eba5a4a01463fd48e45126a379
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
python setup.py install
cd ..git config --global http.sslVerify false
git clone https://github.com/openai/CLIP.git
cd CLIP git checkout d50d76daa670286dd6cacf3bcd80b5e4823fc8e1
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
python setup.py install
cd ..git config --global http.sslVerify false
git clone https://github.com/mlfoundations/open_clip.git
cd open_clip git checkout bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
python setup.py install
cd ..# 下载模型
wget -nc -P ~/stable-diffusion-webui/models/Stable-diffusion https://huggingface.co/andite/anything-v4.0/resolve/main/anything-v4.5-pruned.safetensors -O anything-v4.5-pruned.safetensors./webui.sh --xformers --skip-install# 面部修复功能报错
# 下载模型文件
cd ~/stable-diffusion-webui
wget https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth
mv codeformer.pth ~/stable-diffusion-webui/models/Codeformer/codeformer-v0.1.0.pt
# 下载权重文件
wget https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth
mv detection_Resnet50_Final.pth ~/stable-diffusion-webui/repositories/CodeFormer/weights/facelib/detection_Resnet50_Final.pth
wget https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/parsing_parsenet.pth
mv parsing_parsenet.pth ~/stable-diffusion-webui/repositories/CodeFormer/weights/facelib/parsing_parsenet.pth
stable diffusion教程
models
stable-diffusion-v1-5: https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main
The 10 Best Stable Diffusion Models by Popularity (SD Models Explained)https://aituts.com/models/
AI 绘画与作画 stable diffusion webui 常见模型汇总及简介https://www.tjsky.net/tutorial/583
C站下载模型https://civitai.com/
hugging face下载https://huggingface.co/models
ControlNet下载 https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main
lora模型下载https://openai.wiki/lora-model-part-1.html
tutorial
AIGC入门教程Stable Diffusion万字保姆篇https://www.woshipm.com/ai/5813208.html
超详细外婆都能看懂的Stable Diffusion入门教程https://www.uisdc.com/stable-diffusion-3
How to use Stable Diffusion v2.1 (AUTOMATIC1111 Guide)https://aituts.com/install-stable-diffusion-v2-1/
stable-diffusion-webui使用手册https://ivonblog.com/posts/stable-diffusion-webui-manuals/zh-cn/installation/windows-installation/
Stable Diffusion 速览: https://www.zhihu.com/question/550101073/answer/2931261853
AI绘画指南 stable diffusion webui SD webui如何设置与使用https://www.tjsky.net/tutorial/488
How to use modelsLoRAhttps://github.com/civitai/civitai/wiki/How-to-use-models#lora
How to generate realistic people in Stable Diffusionhttps://stable-diffusion-art.com/realistic-people/
How to make a video with Stable Diffusion (Deforum)https://stable-diffusion-art.com/deforum/
AI绘画教程从入门到放弃(xiaobai)https://zhuanlan.zhihu.com/p/607892849
LoRA模型的训练脚本https://github.com/kohya-ss/sd-scripts
prompt reference
风格提示词https://lexica.art/
image on playgroundai: https://playgroundai.com/c/landscapes