Stable Diffusion 是一种开源机器学习模型,可以从文本生成图像,根据文本修改图像,或者在低分辨率或低细节图像上填充细节。
Stable Diffusion 已经过数十亿张图像的训练,可以产生与从 DALL-E 2 和 MidJourney 获得的结果相当的结果。 它由 Stability AI 开发,并于 2022 年 8 月 22 日首次公开发布。
Stable Diffusion 可以在 windows 电脑上完全免费使用。
本文介绍 Stable Diffusion 在 Windows 11 操作系统上的详细安装步骤。
- 安装 Python
社区推荐安装 Python 3.10.6,但笔者安装的是 3.10.8:
大家可以直接通过这个链接下载 Python.
打开 Stable Diffusion 的 Github 仓库:
点击 Code->Download Zip
将其下载到本地:
下载到本地,解压。
https://huggingface.co/CompVis/stable-diffusion-v-1-4-original
启动日志,会自动下载 torch
和 torchvision
:
耐心等待其下载完毕:
如果启动时遇到如下错误消息:
File "C:\app\stable-diffusion-webui-master\launch.py", line 355, in <module>
prepare_environment()
File "C:\app\stable-diffusion-webui-master\launch.py", line 260, in prepare_environment
run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'")
File "C:\app\stable-diffusion-webui-master\launch.py", line 121, in run_python
return run(f'"{python}" -c "{code}"', desc, errdesc)
File "C:\app\stable-diffusion-webui-master\launch.py", line 97, in run
raise RuntimeError(message)
RuntimeError: Error running command.
Command: "C:\app\stable-diffusion-webui-master\venv\Scripts\python.exe" -c "import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'"
Error code: 1
stdout: <empty>
stderr: C:\app\stable-diffusion-webui-master\venv\lib\site-packages\torch\cuda_init_.py:88: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10020). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at ..\c10\cuda\CUDAFunctions.cpp:109.)
return torch._C._cuda_getDeviceCount() > 0
Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/1742
https://github.com/TencentARC/GFPGAN
按照错误消息的提示去纠正:
找到了报这条错误消息的准确地址:
启动成功了: