在这个框架中,每个组件都有其特定的角色和功能,它们通过Web UI这个桥梁相互连接,共同为用户提供服务。用户通过浏览器与Web服务器交互,而Web服务器则负责与后端的Stale Diffusion模型进行通信,以完成图片生成的任务。 




sudo apt-get update
sudo apt upgradewget https://cn.download.nvidia.com/XFree86/Linux-x86_64/550.100/NVIDIA-Linux-x86_64-550.100.runsudo apt-get update
sudo apt-get install g++
sudo apt-get install gcc
sudo apt-get install makesudo apt-get remove --purge nvidia* sudo vim /etc/modprobe.d/blacklist.confblacklist nouveau
options nouveau modeset=0sudo cat /etc/modprobe.d/blacklist.confsudo update-initramfs -usudo rebootsudo chmod 777 NVIDIA-Linux-x86_64-550.100.runsudo ./NVIDIA-Linux-x86_64-550.100.runnvidia-smi
wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.runsudo chmod 777 cuda_12.4.0_550.54.14_linux.runsudo ./cuda_12.4.0_550.54.14_linux.run
然后选择 Install 开始安装sudo vim ~/.bashrcexport PATH="/usr/local/cuda-12.4/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH"source ~/.bashrcnvcc -V
wget -c https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.shbash Anaconda3-2023.03-1-Linux-x86_64.sh
注意:这里要按 Enter 确认安装位置 /root/anaconda3 
vim /etc/profileexport PATH="~/anaconda3/bin:$PATH"vim ~/.bashrcexport PATH="~/anaconda3/bin:$PATH"source /etc/profile
source ~/.bashrcconda -V
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/conda config --set show_channel_urls yespip config set globalThis.index-url https://pypi.tuna.tsinghua.edu.cn/simplesudo apt-get install libgoogle-perftools4 libtcmalloc-minimal4 -yconda create -n sd python=3.10.6git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.gitgit clone https://mirror.ghproxy.com/https://github.com/AUTOMATIC1111/stable-diffusion-webui.gitcd stable-diffusion-webui
在/root/stable-diffusion-webui/modules文件夹中找到 launch_utils.py 下的prepare_environment()函数,将其中涉及到 github 仓库的依赖,全部添加 https://mirror.ghproxy.com/镜像按Ctrl+F查找https://github.com/全部替换成https://mirror.ghproxy.com/https://github.com/如下图
export HF_ENDPOINT=https://hf-mirror.com echo 'export HF_ENDPOINT="https://hf-mirror.com"' >> ~/.bashrcsource ~/.bashrc
如果是root用户还要将can_run_as_root变量值改为1
2.Stable Diffusion+WebUI 安装conda activate sdpip3 install torch==2.1.2 torchvision torchaudio --extra-index-url https://pypi.tuna.tsinghua.edu.cn/simplepip install -r requirements.txt ./webui.sh --port 15026 --listen --enable-insecure-extension-access --xformers

