【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

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

曾小蛙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值