From 3e5ade9352eff19e04ad816d74dc86095099f9bd Mon Sep 17 00:00:00 2001 From: yangapku Date: Thu, 28 Sep 2023 17:10:20 +0800 Subject: [PATCH] update readme --- README.md | 4 +-- README_CN.md | 4 +-- README_JA.md | 4 +-- finetune/finetune_qlora_single_gpu.sh | 37 --------------------------- 4 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 finetune/finetune_qlora_single_gpu.sh diff --git a/README.md b/README.md index 5c6a772..6aabc54 100644 --- a/README.md +++ b/README.md @@ -395,11 +395,9 @@ sh finetune/finetune_lora_single_gpu.sh sh finetune/finetune_lora_ds.sh ``` -In comparison with full-parameter finetuning, LoRA ([paper](https://arxiv.org/abs/2106.09685)) only updates the parameters of adapter layers but keeps the original large language model layers frozen. This allows much fewer memory costs and thus fewer computation costs. However, if you still suffer from insufficient memory, you can consider Q-LoRA ([paper](https://arxiv.org/abs/2305.14314)), which uses the quantized large language model and other techniques such as paged attention to allow even fewer memory costs. To run Q-LoRA, directly run the following script: +In comparison with full-parameter finetuning, LoRA ([paper](https://arxiv.org/abs/2106.09685)) only updates the parameters of adapter layers but keeps the original large language model layers frozen. This allows much fewer memory costs and thus fewer computation costs. However, if you still suffer from insufficient memory, you can consider Q-LoRA ([paper](https://arxiv.org/abs/2305.14314)), which uses the quantized large language model and other techniques such as paged attention to allow even fewer memory costs. To run Q-LoRA, directly run the following script (In terms of QLoRA, temporarily we found problems with mixed precision training in the setup of single GPU. We'll fix it as soon as possible): ```bash -# Single GPU training -sh finetune/finetune_qlora_single_gpu.sh # Distributed training sh finetune/finetune_qlora_ds.sh ``` diff --git a/README_CN.md b/README_CN.md index 64534bc..5c56708 100644 --- a/README_CN.md +++ b/README_CN.md @@ -381,11 +381,9 @@ sh finetune/finetune_lora_single_gpu.sh sh finetune/finetune_lora_ds.sh ``` -与全参数微调不同,LoRA ([论文](https://arxiv.org/abs/2106.09685)) 只更新adapter层的参数而无需更新原有语言模型的参数。这种方法允许用户用更低的显存开销来训练模型,也意味着更小的计算开销。然而,如果你依然遇到显存不足的问题,可以考虑使用Q-LoRA ([论文](https://arxiv.org/abs/2305.14314))。该方法使用4比特量化模型以及paged attention等技术实现更小的显存开销。运行Q-LoRA你只需运行如下脚本: +与全参数微调不同,LoRA ([论文](https://arxiv.org/abs/2106.09685)) 只更新adapter层的参数而无需更新原有语言模型的参数。这种方法允许用户用更低的显存开销来训练模型,也意味着更小的计算开销。然而,如果你依然遇到显存不足的问题,可以考虑使用Q-LoRA ([论文](https://arxiv.org/abs/2305.14314))。该方法使用4比特量化模型以及paged attention等技术实现更小的显存开销。运行Q-LoRA你只需运行如下脚本(目前QLoRA在单卡训练时混合精度暂时还存在一些问题,我们会尽快完成修复和更新): ```bash -# 单卡训练 -sh finetune/finetune_qlora_single_gpu.sh # 分布式训练 sh finetune/finetune_qlora_ds.sh ``` diff --git a/README_JA.md b/README_JA.md index b1b0d8e..6e1f986 100644 --- a/README_JA.md +++ b/README_JA.md @@ -389,11 +389,9 @@ sh finetune/finetune_lora_single_gpu.sh sh finetune/finetune_lora_ds.sh ``` -LoRA ([論文](https://arxiv.org/abs/2106.09685)) は、フルパラメーターによるファインチューニングと比較して、adapterのパラメーターを更新するだけで、元の大きな言語モデル層は凍結されたままである。そのため、メモリコストが大幅に削減でき、計算コストも削減できる。しかし、それでもメモリ不足に悩む場合は、Q-LoRA([論文](https://arxiv.org/abs/2305.14314))を検討することができます。これは、量子化されたラージ言語モデルと、ページド・アテンションなどの他のテクニックを使用し、さらに少ないメモリコストで実行することができます。Q-LoRAを実行するには、以下のスクリプトを直接実行してください: +LoRA ([論文](https://arxiv.org/abs/2106.09685)) は、フルパラメーターによるファインチューニングと比較して、adapterのパラメーターを更新するだけで、元の大きな言語モデル層は凍結されたままである。そのため、メモリコストが大幅に削減でき、計算コストも削減できる。しかし、それでもメモリ不足に悩む場合は、Q-LoRA([論文](https://arxiv.org/abs/2305.14314))を検討することができます。これは、量子化されたラージ言語モデルと、ページド・アテンションなどの他のテクニックを使用し、さらに少ないメモリコストで実行することができます。Q-LoRAを実行するには、以下のスクリプトを直接実行してください(QLoRA に関しては、単一 GPU のセットアップにおける混合精度トレーニングに一時的に問題が見つかりました。 できるだけ早く修正させていただきます): ```bash -# シングルGPUトレーニング -sh finetune/finetune_qlora_single_gpu.sh # 分散トレーニング sh finetune/finetune_qlora_ds.sh ``` diff --git a/finetune/finetune_qlora_single_gpu.sh b/finetune/finetune_qlora_single_gpu.sh deleted file mode 100644 index bf65b9f..0000000 --- a/finetune/finetune_qlora_single_gpu.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -export CUDA_DEVICE_MAX_CONNECTIONS=1 -DIR=`pwd` - -MODEL="Qwen/Qwen-7B-Chat-Int4" # Set the path if you do not want to load from huggingface directly -# ATTENTION: specify the path to your training data, which should be a json file consisting of a list of conversations. -# See the section for finetuning in README for more information. -DATA="path_to_data" - -export CUDA_VISIBLE_DEVICES=0 - -# Remember to use --fp16 instead of --bf16 due to autogptq -python finetune.py \ - --model_name_or_path $MODEL \ - --data_path $DATA \ - --fp16 True \ - --output_dir output_qwen \ - --num_train_epochs 5 \ - --per_device_train_batch_size 2 \ - --per_device_eval_batch_size 1 \ - --gradient_accumulation_steps 8 \ - --evaluation_strategy "no" \ - --save_strategy "steps" \ - --save_steps 1000 \ - --save_total_limit 10 \ - --learning_rate 1e-5 \ - --weight_decay 0.1 \ - --adam_beta2 0.95 \ - --warmup_ratio 0.01 \ - --lr_scheduler_type "cosine" \ - --logging_steps 1 \ - --report_to "none" \ - --model_max_length 2048 \ - --lazy_preprocess True \ - --gradient_checkpointing \ - --use_lora \ - --q_lora \ No newline at end of file