Windows系統(tǒng)rwkv的lora微調(diào)【wls2】

簡(jiǎn)介裝不下了我再補(bǔ)充幾句疑難雜癥
目前對(duì)比來(lái)看wsl2好像和Linux微調(diào)上速度差別不太大,不想裝Linux可以裝,但是安裝過(guò)程坑蠻多,Tesla顯卡(至少M(fèi)40是這樣)好像是不能裝wsl2的。
經(jīng)過(guò)2080ti測(cè)試bf16速度是fp16的5倍(因?yàn)?080ti本身是沒(méi)有bf16的,所以會(huì)慢很多)
一、遇到微軟商店報(bào)錯(cuò)0x80131500,參考:
https://www.reneelab.com.cn/code-0x80131500.html
https://blog.csdn.net/hhxy_wlzx/article/details/128792651
或關(guān)了魔法
----------------------------------------------------------
二、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必須裝這個(gè)】: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創(chuàng)建環(huán)境報(bào)錯(cuò)【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
上面不行就換回默認(rèn)源多試幾次:
conda config --remove-key channels
----------------------------------------------------------
五、限制wsl2占比過(guò)高的方法
在用戶(hù)目錄下 C:\Users\Administrator(根據(jù)你自己的用戶(hù)名來(lái))新建一個(gè) .wslconfig文件
內(nèi)容:
[wsl2]
memory=4GB #僅分配給WSL內(nèi)存3GB
processors=1 #僅使用的核心數(shù)量
swap=4GB #設(shè)置交換分區(qū)僅4GB
localhostForwarding=true
上面參數(shù)根據(jù)實(shí)際需求進(jìn)行調(diào)整
----------------------------------------------------------
六、使用
當(dāng)你部署完以后第二次想要微調(diào)時(shí),只需以下三步
1.打開(kāi)Ubuntu,根據(jù)你的需求cd進(jìn)相應(yīng)目錄
2.進(jìn)入環(huán)境:conda activate train
3.直接輸入你需要的代碼(數(shù)據(jù)轉(zhuǎn)換、lora微調(diào)等),這個(gè)環(huán)境通用性比較強(qiáng),其他rwkv的項(xiàng)目用這個(gè)環(huán)境應(yīng)該也是沒(méi)問(wèn)題的。
----------------------------------------------------------
七、其他微調(diào)問(wèn)題
經(jīng)過(guò)測(cè)試,pile/raven的模型在train.py的235行【# Found deepspeed】的注釋會(huì)報(bào)錯(cuò)只要?jiǎng)h除這行就行。
world模型微調(diào)如果遇到【offset must be non-negative and no greater than buffer length】的報(bào)錯(cuò),到下列地址下載最新版代碼就行:https://github.com/Blealtan/RWKV-LM-LoRA