马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
1. 搭建Python情况
使用conda创建单独的假造情况sd, 打开终端,运行:
- conda create -n sd python==3.10.9
复制代码 然后激活情况:
安装torch
检察自己的cuda版本,在pytorch官网链接: link
选择对应的torch版本,并直接拷贝安装下令。
我根据我的电脑cuda版本(10.2)安装torch指令为:
- // 安装torch
- conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=10.2 -c pytorch
复制代码 2. 下载stable-diffusion-webui
可以直接用链接下载使用git下令下载stable-diffusion-webui源码(二选一即可):
- // 下载stable-diffusion-webui(二选一,下面一行更稳定)
- git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
- git clone https://gitee.com/yiouyou/automatic1111-stable-diffusion-webui.git
复制代码 3. 下载训练模子
打开链接 link,下载训练模子v2-1_768-ema-pruned.ckpt至stable-diffusion-webui的models/Stable-diffusion目次下,这个目次专门存放用于天生AI绘图的绘图元素的底子模子库。
4. 安装依靠
升级pip并更改默认库包下载所在为清华镜像
- // 可以不换,只是这样更稳定
- python -m pip install --upgrade pip
- pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
复制代码 切换到webui目次下,安装依靠
- cd stable-diffusion-webui/
- pip install -r requirements_versions.txt
- pip install -r requirements.txt
复制代码 安装完成后,启动stable-diffusion-webui
- // 这里要安装很多依赖,并且要git clone相关包和模型文件,需要科学上网,否则会失败
- python launch.py
复制代码 启动后会在欣赏器打开url,表现情况摆设乐成
5. 报错:NansException: A tensor with all NaNs was produced in Unet. This could be either because there’s not enough precision to represent the picture, or because your video card does not support half type. Try setting the “Upcast cross attention layer to float32” option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this. Use --disable-nan-check commandline argument to disable this check.
Settings > Stable Diffusion 勾选 upcast cross attention layer to float32
点应用设置,重新加载,就可以啦
|