-
Notifications
You must be signed in to change notification settings - Fork 3k
[LLM] Support prefix tuning and lora for qwen2 #8601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6e50b48
add unittest for qwen2
DrownFish19 4400863
Merge branch 'PaddlePaddle:develop' into dev_add_tests_qwen2
DrownFish19 87c9418
update for tie_word_embeddings
DrownFish19 540cb5f
Merge branch 'dev_add_tests_qwen2' of github.com:DrownFish19/PaddleNL…
DrownFish19 039bff2
update qwen2
DrownFish19 514246d
update for tokenizer set attr to null
DrownFish19 d96f963
support prefix training
DrownFish19 550b5c6
fix llm unittest
DrownFish19 bbadb99
fix pipeline and sequence parallel
DrownFish19 43a4238
Merge branch 'PaddlePaddle:develop' into dev_add_tests_qwen2
DrownFish19 cda2c3d
add pretrain configs
DrownFish19 7f16f4e
add lora, prefix tuning, sft config
DrownFish19 1f588d0
Merge branch 'PaddlePaddle:develop' into dev_add_tests_qwen2
DrownFish19 de853a9
fix pp for lora and recompute
DrownFish19 cb19d31
Merge branch 'dev_add_tests_qwen2' of github.com:DrownFish19/PaddleNL…
DrownFish19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"model_name_or_path": "Qwen/Qwen2-7B", | ||
"dataset_name_or_path": "./data", | ||
"output_dir": "./checkpoints/qwen2_7b__lora_ckpts", | ||
"per_device_train_batch_size": 4, | ||
"gradient_accumulation_steps": 4, | ||
"per_device_eval_batch_size": 8, | ||
"eval_accumulation_steps": 16, | ||
"num_train_epochs": 3, | ||
"learning_rate": 3e-04, | ||
"warmup_steps": 30, | ||
"logging_steps": 1, | ||
"evaluation_strategy": "epoch", | ||
"save_strategy": "epoch", | ||
"src_length": 2048, | ||
"max_length": 4096, | ||
"bf16": true, | ||
"fp16_opt_level": "O2", | ||
"do_train": true, | ||
"do_eval": true, | ||
"disable_tqdm": true, | ||
"load_best_model_at_end": true, | ||
"eval_with_do_generation": false, | ||
"metric_for_best_model": "accuracy", | ||
"recompute": true, | ||
"save_total_limit": 1, | ||
"tensor_parallel_degree": 1, | ||
"pipeline_parallel_degree": 1, | ||
"lora": true, | ||
"zero_padding": false, | ||
"use_flash_attention": false | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"model_name_or_path": "Qwen/Qwen1.5-7B", | ||
"tokenizer_name_or_path": "Qwen/Qwen1.5-7B", | ||
"input_dir": "./data", | ||
"output_dir": "./checkpoints/qwen1.5_7b_pretrain_ckpts", | ||
"per_device_train_batch_size": 2, | ||
"gradient_accumulation_steps": 8, | ||
"per_device_eval_batch_size": 2, | ||
"tensor_parallel_degree": 2, | ||
"pipeline_parallel_degree": 1, | ||
"sharding_parallel_degree": 4, | ||
"sharding": "stage2", | ||
"virtual_pp_degree": 1, | ||
"sequence_parallel": 0, | ||
"use_flash_attention": true, | ||
"use_fused_rms_norm": true, | ||
"use_fused_rope": true, | ||
"max_seq_length": 4096, | ||
"learning_rate": 3e-05, | ||
"min_learning_rate": 3e-06, | ||
"warmup_steps": 30, | ||
"logging_steps": 1, | ||
"max_steps": 10000, | ||
"save_steps": 5000, | ||
"eval_steps": 1000, | ||
"weight_decay": 0.01, | ||
"bf16": true, | ||
"fp16_opt_level": "O2", | ||
"warmup_ratio": 0.01, | ||
"max_grad_norm": 1.0, | ||
"dataloader_num_workers": 1, | ||
"continue_training": 1, | ||
"do_train": true, | ||
"do_eval": true, | ||
"do_predict": true, | ||
"disable_tqdm": true, | ||
"recompute": true, | ||
"distributed_dataloader": 1, | ||
"recompute_granularity": "full", | ||
"save_total_limit": 2 | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"model_name_or_path": "Qwen/Qwen2-7B", | ||
"tokenizer_name_or_path": "Qwen/Qwen2-7B", | ||
"input_dir": "./data", | ||
"output_dir": "./checkpoints/qwen2_7b_pretrain_ckpts", | ||
"per_device_train_batch_size": 2, | ||
"gradient_accumulation_steps": 8, | ||
"per_device_eval_batch_size": 2, | ||
"tensor_parallel_degree": 2, | ||
"pipeline_parallel_degree": 1, | ||
"sharding_parallel_degree": 4, | ||
"sharding": "stage2", | ||
"virtual_pp_degree": 1, | ||
"sequence_parallel": 0, | ||
"use_flash_attention": true, | ||
"use_fused_rms_norm": true, | ||
"use_fused_rope": true, | ||
"max_seq_length": 4096, | ||
"learning_rate": 3e-05, | ||
"min_learning_rate": 3e-06, | ||
"warmup_steps": 30, | ||
"logging_steps": 1, | ||
"max_steps": 10000, | ||
"save_steps": 5000, | ||
"eval_steps": 1000, | ||
"weight_decay": 0.01, | ||
"bf16": true, | ||
"fp16_opt_level": "O2", | ||
"warmup_ratio": 0.01, | ||
"max_grad_norm": 1.0, | ||
"dataloader_num_workers": 1, | ||
"continue_training": 1, | ||
"do_train": true, | ||
"do_eval": true, | ||
"do_predict": true, | ||
"disable_tqdm": true, | ||
"recompute": false, | ||
"distributed_dataloader": 1, | ||
"recompute_granularity": "full", | ||
"save_total_limit": 2 | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"model_name_or_path": "Qwen/Qwen2-7B", | ||
"dataset_name_or_path": "./data", | ||
"output_dir": "./checkpoints/qwen2_7b_pt_ckpts", | ||
"per_device_train_batch_size": 4, | ||
"gradient_accumulation_steps": 4, | ||
"per_device_eval_batch_size": 8, | ||
"eval_accumulation_steps": 16, | ||
"num_train_epochs": 3, | ||
"learning_rate": 3e-02, | ||
"warmup_steps": 30, | ||
"logging_steps": 1, | ||
"evaluation_strategy": "epoch", | ||
"save_strategy": "epoch", | ||
"src_length": 2048, | ||
"max_length": 4096, | ||
"bf16": true, | ||
"fp16_opt_level": "O2", | ||
"do_train": true, | ||
"do_eval": true, | ||
"disable_tqdm": true, | ||
"load_best_model_at_end": true, | ||
"eval_with_do_generation": false, | ||
"metric_for_best_model": "accuracy", | ||
"recompute": true, | ||
"save_total_limit": 1, | ||
"tensor_parallel_degree": 1, | ||
"pipeline_parallel_degree": 1, | ||
"prefix_tuning": true, | ||
"zero_padding": false, | ||
"use_flash_attention": false | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"model_name_or_path": "Qwen/Qwen2-7B", | ||
"dataset_name_or_path": "./data", | ||
"output_dir": "./checkpoints/qwen2-7b_sft_ckpts", | ||
"per_device_train_batch_size": 1, | ||
"gradient_accumulation_steps": 4, | ||
"per_device_eval_batch_size": 8, | ||
"eval_accumulation_steps":16, | ||
"num_train_epochs": 3, | ||
"learning_rate": 3e-05, | ||
"warmup_steps": 30, | ||
"logging_steps": 1, | ||
"evaluation_strategy": "epoch", | ||
"save_strategy": "epoch", | ||
"src_length": 2048, | ||
"max_length": 4096, | ||
"bf16": true, | ||
"fp16_opt_level": "O2", | ||
"do_train": true, | ||
"do_eval": true, | ||
"disable_tqdm": true, | ||
"load_best_model_at_end": true, | ||
"eval_with_do_generation": false, | ||
"metric_for_best_model": "accuracy", | ||
"recompute": true, | ||
"save_total_limit": 1, | ||
"tensor_parallel_degree": 4, | ||
"pipeline_parallel_degree": 1, | ||
"zero_padding": false, | ||
"use_flash_attention": false | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ | |
|
||
from .configuration import * | ||
from .modeling import * | ||
from .modeling_pp import * | ||
from .tokenizer import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
赞👍🏻