Windows系统rwkv的lora微调【wls2】

简介装不下了我再补充几句疑难杂症
目前对比来看wsl2好像和Linux微调上速度差别不太大,不想装Linux可以装,但是安装过程坑蛮多,Tesla显卡(至少M40是这样)好像是不能装wsl2的。
经过2080ti测试bf16速度是fp16的5倍(因为2080ti本身是没有bf16的,所以会慢很多)
一、遇到微软商店报错0x80131500,参考:
https://www.reneelab.com.cn/code-0x80131500.html
https://blog.csdn.net/hhxy_wlzx/article/details/128792651
或关了魔法
----------------------------------------------------------
二、wsl2的cuda地址
11.7:https://developer.nvidia.com/cuda-11-7-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local
最新:https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local
----------------------------------------------------------
三、torch安装:
1.13.1【使用bf16必须装这个】:pip install torch==1.13.1 --extra-index-url https://download.pytorch.org/whl/cu117 --upgrade
最新:pip install torch --extra-index-url https://download.pytorch.org/whl/cu117 --upgrade
----------------------------------------------------------
四、conda创建环境报错【solving environment: failed with repodata from current_repodata.json, will retry with next repodata】:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
上面不行就换回默认源多试几次:
conda config --remove-key channels
----------------------------------------------------------
五、限制wsl2占比过高的方法
在用户目录下 C:\Users\Administrator(根据你自己的用户名来)新建一个 .wslconfig文件
内容:
[wsl2]
memory=4GB #仅分配给WSL内存3GB
processors=1 #仅使用的核心数量
swap=4GB #设置交换分区仅4GB
localhostForwarding=true
上面参数根据实际需求进行调整
----------------------------------------------------------
六、使用
当你部署完以后第二次想要微调时,只需以下三步
1.打开Ubuntu,根据你的需求cd进相应目录
2.进入环境:conda activate train
3.直接输入你需要的代码(数据转换、lora微调等),这个环境通用性比较强,其他rwkv的项目用这个环境应该也是没问题的。
----------------------------------------------------------
七、其他微调问题
经过测试,pile/raven的模型在train.py的235行【# Found deepspeed】的注释会报错只要删除这行就行。
world模型微调如果遇到【offset must be non-negative and no greater than buffer length】的报错,到下列地址下载最新版代码就行:https://github.com/Blealtan/RWKV-LM-LoRA