RWKV-PEFT
[ English | 中文 ]
RWKV-PEFT is the official implementation for efficient parameter fine-tuning of RWKV5/6 models, supporting various advanced fine-tuning methods across multiple hardware platforms.
[!IMPORTANT] Installation is mandatory.
git clone https://github.com/JL-er/RWKV-PEFT.git
cd RWKV-PEFT
pip install -r requirements.txt
[!TIP] If you are using a cloud server (such as Vast or AutoDL), you can start the Streamlit service by referring to the help documentation on the cloud server's official website.
streamlit run web/app.py
The following shows memory usage when using an RTX 4090 (24GB VRAM) + 64GB RAM (with parameters: --strategy deepspeed_stage_1 --ctx_len 1024 --micro_bsz 1 --lora_r 64
):
Model Size | Full Finetuning | LoRA/PISSA | QLoRA/QPISSA | State Tuning |
---|---|---|---|---|
RWKV6-1.6B | OOM | 7.4GB | 5.6GB | 6.4GB |
RWKV6-3B | OOM | 12.1GB | 8.2GB | 9.4GB |
RWKV6-7B | OOM | 23.7GB* | 14.9GB** | 18.1GB |
Note:
Install dependencies:
pip install -r requirements.txt
Run example script:
sh scripts/run_lora.sh
Note: Please refer to the RWKV official tutorial for detailed data preparation
Start with web GUI:
[!TIP] If you're using cloud services (such as Vast or AutoDL), you'll need to enable web port access according to your service provider's instructions.
streamlit run web/app.py
--peft bone --bone_config $lora_config
--train_parts ["time", "ln"]
--quant int8/nf4
--train_type infctx --chunk_ctx 512 --ctx_len 2048
--dataload pad
--strategy deepspeed_stage_1
Available strategies:
By default, RWKV-PEFT uses custom CUDA kernels for wkv computation.
However, you can use --fla
to enable the Triton kernel:
--fla
--fla
If you find this project helpful, please cite our work:
@misc{kang2024boneblockaffinetransformation,
title={Bone: Block Affine Transformation as Parameter Efficient Fine-tuning Methods for Large Language Models},
author={Jiale Kang},
year={2024},
eprint={2409.15371},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2409.15371}
}