赞
踩
1 搭建基本环境
yum install epel-release -y
yum update -y
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum -y install ffmpeg ffmpeg-devel
yum install -y git
下载Anaconda
wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
如果没有wget则可以通过以下命令安装yum install wget -y
2、安装Anaconda
增加执行权限: chmod +x Anaconda3-2023.03-1-Linux-x86_64.sh
开始执行:./Anaconda3-2023.03-1-Linux-x86_64.sh
3 创建虚拟环境:conda create -n sd python=3.10.6
切换到SD:conda activate sd
4 安装git conda install git
############################################################
https://pypi.org/simple --trusted-host pypi.org/simple
4 下载代码stable-diffusion-webui
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
5 开始安装需要的环境
cd stable-diffusion-webui/
6 注意转换一下文件格式
yum install dos2unix
dos2unix requirements_versions.txt
dos2unix requirements.txt
7 开始安装需要的python环境( 指定源)
awk '{print " pip install " $1 " -i https://pypi.org/simple --trusted-host pypi.org/simple "}' requirements_versions.txt |sh
8 出现问 ERROR: No matching distribution found for cython
pip install cython
9 安装需要的环境
awk '{print " pip install " $1 " -i https://pypi.org/simple --trusted-host pypi.org/simple "}' requirements.txt |sh
10 修改启动脚本(webui.sh )
删除下面部分(使用root运行)
# Do not run as root
if [[ $(id -u) -eq 0 && can_run_as_root -eq 0 ]]
then
printf "\n%s\n" "${delimiter}"
printf "\e[1m\e[31mERROR: This script must not be launched as root, aborting...\e[0m"
printf "\n%s\n" "${delimiter}"
exit 1
else
printf "\n%s\n" "${delimiter}"
printf "Running on \e[1m\e[32m%s\e[0m user" "$(whoami)"
printf "\n%s\n" "${delimiter}"
fi
11 开始启动系统(第一次启动默认下载安装包)
sh webui.sh
# 默认下载的模型的远端地址
https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors
下载到的不本地地址
/app/sd/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
# 开启远端访问
sh webui.sh --listen
###############
# 下载文件
git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
# 安装需要的环境
awk '{print " pip install " $1 " -i https://pypi.org/simple --trusted-host pypi.org/simple "}' requirements_linux.txt |sh
awk '{print " pip install " $1 " -i https://pypi.org/simple --trusted-host pypi.org/simple "}' requirements.txt |sh
yum install -y python3-tkinter
# 运行安装脚本
sh setup.sh
# 需要下载的文件如下
16:03:57-174553 INFO Installing modules from requirements_linux.txt...
# 启动的脚步如下(注意使用参数)
python kohya_gui.py --listen 0.0.0.0 --server_port 7861 --inbrowser --share
#######################
git clone https://github.com/facefusion/facefusion.git
awk '{print " pip install " $1 " -i https://pypi.org/simple --trusted-host pypi.org/simple "}' requirements.txt |sh
yum -y groupinstall 'Development Tools'
pip install typing-extensions --upgrade
pip install tb-nightly -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
#(选默认不使用CUDA 设计到CUAD版本必须是11。8 cudnn版本是8.6.0 环境比较难以搭建)
python install.py
# 解决so的问题
export LD_LIBRARY_PATH=/root/anaconda3/envs/sd/lib/python3.10/site-packages/nvidia/nvjitlink/lib/:$LD_LIBRARY_PATH
# 启动程序(注意第一次启动需要下载文件)
python run.py
注意补充,如果想共享给其它人用,需要修改\facefusion\uis\layouts\default.py的最后一行。
def run(ui : gradio.Blocks) -> None:
ui.launch(show_api = False,share=True,server_name="0.0.0.0")
##############
注意 如果使用代理 需要增加下面的参数
export no_proxy="localhost, 127.0.0.1, ::1"
set no_proxy environment variable on linux shell:
export no_proxy="localhost, 127.0.0.1, ::1"
或者修改代码
or add this line in your app python code:
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
###################
stable diffusion反推提示词出现此提示时,需安装以下模型至sd-webui-aki-v4.cache\clip\目录
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。