
前些天总是刷到Stable Diffuison的相关视频,话说这玩意儿已经火了好长一段时间。作为一个互联网掉队人,笔者决定是时候来体验一番AI作画的神奇之处。
写在前面:这里没有Stable Diffusion的详细介绍,也没有底层逻辑和操作方法的讲解。鉴于多数入门的起点都是GUI,笔者选择了AUTOMATIC1111的Stable Diffusion web UI项目,仅此记录首次本地部署的过程。
安装CUDA Toolkit、Python、Git
打开NVIDIA控制面板查看显卡的CUDA驱动版本

查看CUDA驱动版本
如图,支持的CUDA最高版本为12.1(CUDA驱动可以向下兼容,故这里安装<=12.1的CUDA都是可以的)
下载安装CUDA Toolkit,根据上图的版本下载即可。
下载地址:https://developer.nvidia.com/cuda-toolkit-archive


CUDA Toolkit下载
下载安装Python3.10.6
下载地址:http//www.python.org/downloads/release/python-3106


Python安装
下载安装Git
下载地址:https://git-scm.com/download/win

Git下载
克隆仓库
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git 完成后,打开stable-diffusion-webui文件夹,双击运行webui-user.bat。在漫长的等待后,如命令行中出现以下命令,表示Stable Diffusion web UI已经运行起来了。
Model loaded in 5.2s (load weights from disk: 0.2s, create model: 0.6s, apply weights to model: 1.2s, apply half(): 1.0s, move model to device: 0.9s, load textual inversion embeddings: 1.3s).
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Startup time: 16.1s (import torch: 3.1s, import gradio: 1.6s, import ldm: 0.7s, other imports: 1.5s, setup codeformer: 0.1s, load scripts: 2.8s, load SD checkpoint: 5.4s, create ui: 0.5s, gradio launch: 0.2s). 浏览器打开http://127.0.0.1:7860,生成一只猫试试,还行。


Hello,cat!
至此,初步安装已经完成。
tips:
网络问题导致Git克隆仓库慢、老是失败,pip下载速度慢等,可为Git配置代理,pip可配置国内镜像源。
备份几个仓库的zip文件——4月21日
https://115.com/s/sw6gspk3wta?password=o3c5&#%E9%83%A8%E5%88%86%E4%BB%93%E5%BA%934.21%E8%AE%BF%E9%97%AE%E7%A0%81:o3c5