本指南提供了在 macOS(包括 Apple Silicon M1/M2/M3)上安装和运行 Stable Diffusion Web UI 的完整说明。
-
克隆项目:
git clone https://github.com/tailm/AIpic.git cd AIpic -
运行安装脚本:
./install_macos.sh
-
下载模型文件:
- 将 Stable Diffusion 模型文件(如
v1-5-pruned-emaonly.safetensors)放入models/Stable-diffusion/目录
- 将 Stable Diffusion 模型文件(如
-
启动 Web UI:
./webui.sh
-
在浏览器中打开:http://127.0.0.1:7860
详细步骤请参考 MACOS_INSTALLATION.md。
requirements.txt- 修复了版本依赖的包列表requirements_macos.txt- macOS 专用依赖列表(包含详细说明)install_macos.sh- 一键安装脚本MACOS_INSTALLATION.md- 完整的安装部署文档webui-user.sh- 配置文件(已预配置 macOS 参数)
- torch/torchvision 版本兼容性:使用 macOS ARM 兼容版本
- httpx/httpcore 版本冲突:使用兼容版本
- basicsr 缺少 load_file_from_url 函数:已通过补丁修复
- GFPGAN tb-nightly 依赖问题:跳过安装
- realesrgan 版本冲突:使用兼容版本
- numpy 版本冲突:使用兼容版本
# 跳过 CUDA 测试(macOS 必需)
export COMMANDLINE_ARGS="--skip-torch-cuda-test --port 7860"
# 使用正确的 Python 路径
python_cmd="/path/to/AIpic/venv/bin/python"
# 跳过 GFPGAN 安装
export GFPGAN_PACKAGE=""--medvram:中等 VRAM 模式--lowvram:低 VRAM 模式--no-half:不使用半精度(解决某些兼容性问题)--use-cpu all:完全使用 CPU(无 GPU 时)--listen:允许网络访问--share:创建公共链接
-
"Torch not compiled with CUDA enabled"
- 确保
webui-user.sh中包含--skip-torch-cuda-test
- 确保
-
"ModuleNotFoundError: No module named 'basicsr.utils.download_util'"
- 运行修复脚本:
python scripts/tools/fix/fix_basicsr.py
- 运行修复脚本:
-
端口被占用
- 更改端口号:
--port 7860
- 更改端口号:
-
内存不足
- 添加
--medvram或--lowvram参数 - 减少生成图片的分辨率
- 添加
- 控制台输出:查看启动时的错误信息
webui.log:详细的日志文件
# 在 webui-user.sh 中添加
export COMMANDLINE_ARGS="--skip-torch-cuda-test --use-cpu all --no-half"# 在 webui-user.sh 中添加
export COMMANDLINE_ARGS="--skip-torch-cuda-test --xformers"git pullsource venv/bin/activate
pip install --upgrade -r requirements.txt如果更新后出现导入错误:
python scripts/tools/fix/fix_basicsr.py如果遇到问题:
- 查看 MACOS_INSTALLATION.md 中的故障排除部分
- 检查日志文件
- 确保按照指南的所有步骤操作
本项目基于 Stable Diffusion Web UI,遵循其原始许可证。
注意:由于 macOS ARM 架构的限制,某些功能(如 GFPGAN、最新版 RealESRGAN)可能无法使用。本配置提供了最佳的兼容性方案。