【stable-diffusion】4090显卡下dreambooth、lora、sd模型微调的GUI环境安装(cuda驱动、pytorch、xformer)

相关博文

  1. stable-diffusion-webui的基础功能手动安装,了解代码结构、依赖、模型出处

安装成功结果

在这里插入图片描述

主要参考

一、显卡驱动相关

驱动版本自带cuda 12.0 与pytorch不兼容

驱动要安装官网4090自带的:528.02 cuda12.0 (运维安装跳过)
在这里插入图片描述

pytorch 需要cuda12.0以下

自定义安装
在这里插入图片描述

取消安装驱动

在这里插入图片描述
明确安装位置,好添加到系统路径
在这里插入图片描述
安装成功和失败的
在这里插入图片描述

cudnn 下载与安装

改名放到cuda安装目录下,并添加到环境变量

根目录

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\

结果
在这里插入图片描述

最终环境变量

肯定有些冗余
在这里插入图片描述

二、安装 python3.10 + pytorch

下载安装miniconda (python 3.10.9)

官网直接选择最新版本 : https://docs.conda.io/en/latest/miniconda.html
在这里插入图片描述

添加到系统环境

计算机—》属性—》高级系统设置----》环境变量—》系统变量—》path

根据自己位置改

D:\miniconda310\Scripts
D:\miniconda310

安装pytorch

配置pip的国内源并升级

pip config set global.index-url  https://mirror.baidu.com/pypi/simple
pip config set global.trusted-host mirror.baidu.com
python -m pip install --upgrade pip

查找对应的pytorch

lora dreambooth推荐的环境:https://github.com/bmaltais/kohya_ss/blob/master/setup.bat
在这里插入图片描述

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117

需要15分钟左右时间
在这里插入图片描述

三、其他python依赖包

安装requirements

–upgrade使用最新版本的pip
进入 kohya_ss-master的位置

pip install --upgrade -r requirements.txt

在这里插入图片描述

ERROR: Cannot find command ‘git’ - do you have ‘git’ installed and in your PATH?

https://gitforwindows.org/

conda install git

git不是内部外部命令,添加到系统环境

安装过程截图

开始安装
在这里插入图片描述
成功
在这里插入图片描述

安装 xformer

conda install xformers -c xformers
or
pip install -U xformers

本项目特定环境安装(不然训练报错,必须装

copy /y .\bitsandbytes_windows\*.dll D:\miniconda310\Lib\site-packages\bitsandbytes\
copy /y .\bitsandbytes_windows\cextension.py D:\miniconda310\Lib\site-packages\bitsandbytes\cextension.py
copy /y .\bitsandbytes_windows\main.py D:\miniconda310\Lib\site-packages\bitsandbytes\cuda_setup\main.py

accelerate config  

配置
在这里插入图片描述

erro 训练时报错 No model named ‘triton’

链接:https://pan.baidu.com/s/1shX-cU-R-0_gKhiTM0VXSw
提取码:6666

pip install triton-2.0.0-cp310-cp310-win_amd64.whl

四、启动训练界面

python D:\kohya_ss-master\kohya_gui.py

附录

本项目cudnn8.6 特殊安装

4090使用cudnn8.6能加速50%
在这里插入图片描述
下载后解压,放入文件夹
在这里插入图片描述

将cudnn保存到虚拟环境中

python D:\kohya_ss-master\tools\cudann_1.8_install.py

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/imwaters/article/details/129984112