以下是Stable Diffusion在CentOS上的使用技巧及关键步骤:
sudo yum update -y
,sudo yum install git python3 python3-pip gcc make
。wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
tar -zxvf Python-3.10.6.tgz
cd Python-3.10.6 && ./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
make && sudo make install
ln -s /usr/local/python3/bin/python3.10 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.10 /usr/bin/pip3
pip3 install --upgrade pip
nvidia-smi
。wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
chmod +x webui.sh
./webui.sh
stable-diffusion-webui
目录。http://localhost:7860
(默认端口7860)。sudo yum install docker-ce
,启动服务:sudo systemctl start docker
。docker pull stablediffusion/stable-diffusion-webui
docker run -it --rm -p 80:80 stablediffusion/stable-diffusion-webui
http://localhost
。Euler a
、DPM++ 2M Karras
),调整CFG Scale
(7-12)平衡创意与细节。--device cuda
指定GPU设备,或--device cpu
强制使用CPU(仅适用于测试)。.ckpt
或.safetensors
)并放置于models/Stable-diffusion/
目录。--model path/to/model.ckpt
。--steps
参数,默认50步,可减至20-30步以加快速度)。--skip-torch-cuda-test
跳过CUDA兼容性检查(仅适用于已知兼容的GPU环境)。sudo firewall-cmd --add-port=7860/tcp --permanent
,并重启防火墙。pip install torch==2.0.1+cu118
指定版本。以上步骤参考自,可根据实际需求选择部署方式。