Stable Diffusion AI 绘图学习笔记1

本地部署安装绘图AI神器Stable Diffusion web UI



有一台高配的电脑ThinkPad X1隐士在仓库吃了一年灰,最近得已重见天日。


配置如下:

联想截图_20230406222447.png



 Windows 11 系统,且配有英伟达GTX 3060 独显,6G显存略小,但应该能跑起来了。说干就干,准备好电脑,就开始准备安装。





首先要找靠谱的攻略,不愁没攻略,反倒是资料太多,信息爆炸,各个都号称保姆级的教程。



我用的是这个公众号这个,简单一点:

https://mp.weixin.qq.com/s?__biz=MzI2NzMzMTIwOA==&mid=2247486317&idx=1&sn=7400cbd2eac814fe165b6604d4a29120&chksm=ea81388addf6b19ce4616109820a09e400fa829be9581637a80aa62f0b2f57eab37b3c42641f&mpshare=1&scene=1&srcid=0313Ihh1xeohS2f4MEjKMGxg&sharer_sharetime=1679817460168&sharer_shareid=0c2d83ec9049faeed9f63ba2b3f95e17&exportkey=n_ChQIAhIQS91IH8wHmm8KjsonhoCIeRLwAQIE97dBBAEAAAAAAPIaCsO3JuIAAAAOpnltbLcz9gKNyK89dVj0af9oH%2FH1NEPRIizJJdNP4f0b8sttDbcgLytHX91HzKo3nhvFTWEp6NFzmaPhQkgt%2BLsYOFdUtX1wuAfnPqwya4yl5%2BJwpZAQx0DAGpXAOquWWY%2BPwQK5vFryyA%2FexmYJ%2BqitMYHK7gserSqkURvIP7sfUDIs0GP3sM3NkqnIFhVKxtxfTCzXwZ96g%2B5vB7q%2Bh9m%2FJCGKEdMsf9nSgG2MUXIUsqMF80ZTwNpVVxCHf6myhmi9NKsCJ%2BiAMllSEzP6z8kvqsAtFeKPog%3D%3D&acctmode=0&pass_ticket=Ufijqg57u41rvWTsJJ1AR6M43yiXpXuvNz%2BZUXUUzDU8aCxsUDjKCldThxxEjYd174xcT91DKCcUsf7mlkBgnw%3D%3D&wx_header=0#rd





整体安装过程很顺利,特别几个地方注意下就行:





安装步骤

安装python(安装版本最低3.10.6)

https://www.python.org/downloads/



安装git

https://git-scm.com/download/win



下载Stable Diffusion web UI源码

https://github.com/AUTOMATIC1111/stable-diffusion-webui





双击运行webui-user.bat等待安装,会花费挺长时间安装,全部的安装环境大概10个G

可能出现的问题:



Couldn‘t install gfpgan,以下是报错代码



Installing gfpganTraceback (most recent call last):  File "D:\Work\stable-diffusion-webui\launch.py", line 324, in <module>    prepare_environment()  File "D:\Work\stable-diffusion-webui\launch.py", line 239, in prepare_environment    run_pip(f"install {gfpgan_package}", "gfpgan")  File "D:\Work\stable-diffusion-webui\launch.py", line 106, in run_pip    return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")  File "D:\Work\stable-diffusion-webui\launch.py", line 74, in run    raise RuntimeError(message)RuntimeError: Couldn't install gfpgan.Command: "D:\Work\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 --prefer-binaryError code: 1stdout: Collecting git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379&nbsp; Cloning https://github.com/TencentARC/GFPGAN.git (to revision 8d2447a2d918f8eba5a4a01463fd48e45126a379) to c:\users\cheapmeow\appdata\local\temp\pip-req-build-ww9pc8i8stderr:   Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\CheapMeow\AppData\Local\Temp\pip-req-build-ww9pc8i8'  error: RPC failed; curl 28 Recv failure: Connection was reset  fatal: expected flush after ref listing  error: subprocess-exited-with-error  git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\CheapMeow\AppData\Local\Temp\pip-req-build-ww9pc8i8' did not run successfully.  exit code: 128  See above for output.  note: This error originates from a subprocess, and is likely not a problem with pip.error: subprocess-exited-with-errorgit clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\CheapMeow\AppData\Local\Temp\pip-req-build-ww9pc8i8' did not run successfully.exit code: 128See above for output.note: This error originates from a subprocess, and is likely not a problem with pip.[notice] A new release of pip available: 22.2.1 -> 22.3.1[notice] To update, run: D:\Work\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip

解决办法1[1]



找到stable-diffusion-webui-master文件夹下launch.py,打开编辑这个文件



在所有https://github.com前面添加https://ghproxy.com/。











困惑问题:

按理说需要安装Nvidia CUDA,但我没有安装,最后也能成功运行。





备用攻略:

https://www.tjsky.net/tutorial/488



https://www.bilibili.com/read/cv20466834