本页面记录了用户在使用 Stable Diffusion Web UI 时可能遇到的常见错误,以及相应的解释和解决方案。有关性能优化建议,请参阅 性能优化。
Stable Diffusion Web UI 内置了错误记录和报告系统,可以捕获异常并显示给用户。
Web UI 根据您的操作系统需要特定的 Python 版本
| 操作系统 | 支持的 Python 版本 |
|---|---|
| Windows | 3.10 |
| 其他 | 3.7, 3.8, 3.9, 3.10, 3.11 |
使用不受支持的 Python 版本将显示错误消息,并附带下载 Python 3.10.6 的说明。
来源: modules/launch_utils.py34-62 modules/errors.py52-61
启动时,应用程序会检查 PyTorch 是否可以访问您的 GPU
无可用 CUDA:如果未检测到 GPU 或缺少驱动程序,您会看到
Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
Torch 版本不兼容:如果您使用的版本与预期版本(当前为 2.1.2)不同
You are running torch X.X.X.
The program is tested to work with torch 2.1.2.
To reinstall the desired version, run with commandline flag --reinstall-torch.
来源: modules/launch_utils.py384-391 modules/errors.py104-124
当 Web UI 尝试安装必需的包时,您可能会遇到
Torch 安装失败:
Installing torch and torchvision
Couldn't install torch
Requirements 安装失败:
Installing requirements
Couldn't install requirements
这些错误通常在网络问题、Python 版本不兼容或现有包冲突时出现。
来源: modules/launch_utils.py380-382 modules/launch_utils.py422-424
加载 SD 2.0 模型时未指定配置文件
copying a param with shape torch.Size([640, 1024]) from checkpoint, the shape in current model is torch.Size([640, 768])
解决方案:为模型指定正确的配置文件。
如果找不到模型的必需存储库
Couldn't find Stable Diffusion in any of: [list of paths]
解决方案:确保在安装期间正确克隆了所有必需的存储库。
来源: modules/errors.py74-79 modules/paths.py26-34
Web UI 提供了一个系统信息实用程序来帮助诊断问题
您可以通过将 --dump-sysinfo 添加到启动命令中来生成系统报告,这将创建一个包含全面诊断信息的 JSON 文件。
来源: modules/sysinfo.py45-53 modules/sysinfo.py102-127 modules/launch_utils.py472-482
Web UI 会对关键依赖项执行版本检查,并警告不兼容的情况
| 组件 | 预期版本 | 不匹配时出错 |
|---|---|---|
| PyTorch | 2.1.2 | 带有重装说明的警告 |
| xformers | 0.0.23.post1 | 带有重装说明的警告 |
| gradio | 3.41.2 | 关于损坏的强烈警告 |
不兼容的 gradio 版本尤其成问题,可能导致许多 UI 错误。
扩展可能导致以下错误
install.py 执行失败时扩展错误会被捕获在异常记录系统中,并可以在系统信息报告中查看。
来源: modules/launch_utils.py228-242 modules/launch_utils.py265-277
遇到错误时,请遵循以下步骤
--dump-sysinfo 创建诊断报告--disable-all-extensions 以确定是否是扩展导致了问题git pull 以确保您拥有最新版本--reinstall-torch 或 --reinstall-xformers对于持续存在的问题,在项目的 GitHub issues 或社区论坛寻求帮助时,请提供您的系统信息报告。
来源: modules/launch_utils.py472-482 modules/errors.py103-149
| 错误消息 | 可能的原因 | 解决方案 |
|---|---|---|
| “CUDA out of memory” | 显存不足以完成操作 | 减小批次大小、图像尺寸,或使用 --medvram/--lowvram 选项 |
| “RuntimeError: Couldn't install torch” | 网络问题或环境不兼容 | 检查互联网连接,尝试 --reinstall-torch 选项 |
| “INCOMPATIBLE PYTHON VERSION” | 使用不受支持的 Python 版本 | 按照建议安装 Python 3.10.6 |
| “Torch is not able to use GPU” | GPU 驱动问题或 CUDA 不兼容 | 更新 GPU 驱动程序,检查 CUDA 安装 |
| “ModuleNotFoundError” | 缺少依赖项 | 再次运行安装,但不要使用 --skip-install |
| SD 2.0 的“copying a param with shape”错误 | 配置文件不匹配 | 为 SD 2.0 模型指定正确的配置文件 |
| “You are running gradio X.X.X” | 不兼容的 gradio 版本 | 避免使用 --skip-install,检查是否存在干扰扩展 |
刷新此 Wiki
最后索引时间2025年4月17日(82a973)