Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions examples/train_lora/selectors/cluster_less.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
### model
model_name_or_path: meta-llama/Llama-3.1-8B
trust_remote_code: true

### method
stage: sft
do_train: true
finetuning_type: lora
lora_target: all
lora_rank: 16
lora_alpha: 8

### dataset
dataset: alpaca_en_demo
template: llama3
cutoff_len: 4096
# max_samples: 100000000
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 0
# disable_shuffling: true
seed: 42

### output
output_dir: ../dataflex_saves/Llama-3.1-8B/cluster_less
logging_steps: 10
save_steps: 100
plot_loss: true
save_only_model: false
overwrite_output_dir: true

### swanlab
report_to: none # choices: [none, wandb, tensorboard, swanlab, mlflow]
# use_swanlab: true
# swanlab_project: dynamic_sft
# swanlab_run_name: your_run_name
# swanlab_workspace: your_workspace
# swanlab_api_key: your_api_key

### train
per_device_train_batch_size: 1
gradient_accumulation_steps: 1
learning_rate: 1.0e-4
num_train_epochs: 1.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
ddp_timeout: 180000000

### dynamic_train
train_type: dynamic_select # 选择训练器类型。可选值包括:
# "dynamic_select" - 动态选择训练器
# "dynamic_mix" - 动态混合训练器
# "dynamic_weight" - 动态加权训练器
# "static_full" - 默认静态全量数据训练器
components_cfg_file: src/dataflex/configs/components.yaml
component_name: cluster_less # 选择组件名称,对应 components_cfg_file 中定义的组件
warmup_step: 10
update_step: 10
update_times: 2 # Updates per Flex epoch; repeats by num_train_epochs

## eval
# val_size: 0.001
eval_dataset: alpaca_zh_demo
per_device_eval_batch_size: 1
metric_for_best_model: eval_loss
greater_is_better: false
load_best_model_at_end: false
eval_strategy: steps # choices: [no, steps, epoch]
eval_steps: 10
# early_stopping_steps: 3
# early_stopping_min_delta: 0.01

# FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/selectors/less.yaml
45 changes: 45 additions & 0 deletions examples/train_lora/selectors/cluster_loss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### ClusterLoss: cluster + forward loss scoring + softmax sampling
# FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/selectors/cluster_loss.yaml
model_name_or_path: meta-llama/Llama-3.1-8B
trust_remote_code: true

stage: sft
do_train: true
finetuning_type: lora
lora_target: all
lora_rank: 16
lora_alpha: 8

dataset: alpaca_en_demo
template: llama3
cutoff_len: 4096
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 0
seed: 42

output_dir: ../dataflex_saves/Llama-3.1-8B/cluster_loss
logging_steps: 10
save_steps: 100
plot_loss: true
overwrite_output_dir: true
report_to: none

per_device_train_batch_size: 1
gradient_accumulation_steps: 1
learning_rate: 1.0e-4
num_train_epochs: 1.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
ddp_timeout: 180000000

train_type: dynamic_select
components_cfg_file: src/dataflex/configs/components.yaml
component_name: cluster_loss
warmup_step: 10
update_step: 10
update_times: 2

load_best_model_at_end: false
eval_strategy: "no"
48 changes: 48 additions & 0 deletions examples/train_lora/selectors/cluster_tracin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### ClusterTracIn: cluster + TracIn gradient scoring + softmax sampling
# FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/selectors/cluster_tracin.yaml
model_name_or_path: meta-llama/Llama-3.1-8B
trust_remote_code: true

stage: sft
do_train: true
finetuning_type: lora
lora_target: all
lora_rank: 16
lora_alpha: 8

dataset: alpaca_en_demo
eval_dataset: alpaca_zh_demo
template: llama3
cutoff_len: 4096
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 0
seed: 42

output_dir: ../dataflex_saves/Llama-3.1-8B/cluster_tracin
logging_steps: 10
save_steps: 100
plot_loss: true
overwrite_output_dir: true
report_to: none

per_device_train_batch_size: 1
gradient_accumulation_steps: 1
learning_rate: 1.0e-4
num_train_epochs: 1.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
ddp_timeout: 180000000

train_type: dynamic_select
components_cfg_file: src/dataflex/configs/components.yaml
component_name: cluster_tracin
warmup_step: 10
update_step: 10
update_times: 2

per_device_eval_batch_size: 1
load_best_model_at_end: false
eval_strategy: steps
eval_steps: 10
48 changes: 48 additions & 0 deletions examples/train_lora/selectors/tracin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### TracIn: full-dataset SGD gradients + multi-checkpoint accumulation
# FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/selectors/tracin.yaml
model_name_or_path: meta-llama/Llama-3.1-8B
trust_remote_code: true

stage: sft
do_train: true
finetuning_type: lora
lora_target: all
lora_rank: 16
lora_alpha: 8

dataset: alpaca_en_demo
eval_dataset: alpaca_zh_demo
template: llama3
cutoff_len: 4096
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 0
seed: 42

output_dir: ../dataflex_saves/Llama-3.1-8B/tracin
logging_steps: 10
save_steps: 100
plot_loss: true
overwrite_output_dir: true
report_to: none

per_device_train_batch_size: 1
gradient_accumulation_steps: 1
learning_rate: 1.0e-4
num_train_epochs: 1.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
ddp_timeout: 180000000

train_type: dynamic_select
components_cfg_file: src/dataflex/configs/components.yaml
component_name: tracin
warmup_step: 10
update_step: 10
update_times: 2

per_device_eval_batch_size: 1
load_best_model_at_end: false
eval_strategy: steps
eval_steps: 10
46 changes: 46 additions & 0 deletions examples/train_lora/weighters/multimodal_adapt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
### Multimodal ADAPT: representation similarity with anchor set
# FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/weighters/multimodal_adapt.yaml
model_name_or_path: meta-llama/Llama-3.1-8B
trust_remote_code: true
enable_liger_kernel: false

stage: sft
do_train: true
finetuning_type: lora
lora_target: all
lora_rank: 16
lora_alpha: 8

dataset: alpaca_en_demo
eval_dataset: alpaca_en_demo
template: llama3
cutoff_len: 2048
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 0
seed: 42

output_dir: ../dataflex_saves/multimodal_adapt
logging_steps: 10
save_steps: 100
plot_loss: true
overwrite_output_dir: true
report_to: none

per_device_train_batch_size: 1
gradient_accumulation_steps: 8
learning_rate: 1.0e-4
num_train_epochs: 1.0
lr_scheduler_type: cosine
warmup_ratio: 0.03
bf16: true
ddp_timeout: 180000000

train_type: dynamic_weight
components_cfg_file: src/dataflex/configs/components.yaml
component_name: multimodal_adapt
warmup_step: 100
train_step: 500

load_best_model_at_end: false
eval_strategy: "no"
45 changes: 45 additions & 0 deletions examples/train_lora/weighters/multimodal_deltaloss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### Multimodal DeltaLoss: s = L(R|Q) - L(R|Q,I)
# FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/weighters/multimodal_deltaloss.yaml
model_name_or_path: meta-llama/Llama-3.1-8B
trust_remote_code: true
enable_liger_kernel: false

stage: sft
do_train: true
finetuning_type: lora
lora_target: all
lora_rank: 16
lora_alpha: 8

dataset: alpaca_en_demo
template: llama3
cutoff_len: 2048
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 0
seed: 42

output_dir: ../dataflex_saves/multimodal_deltaloss
logging_steps: 10
save_steps: 100
plot_loss: true
overwrite_output_dir: true
report_to: none

per_device_train_batch_size: 1
gradient_accumulation_steps: 8
learning_rate: 1.0e-4
num_train_epochs: 1.0
lr_scheduler_type: cosine
warmup_ratio: 0.03
bf16: true
ddp_timeout: 180000000

train_type: dynamic_weight
components_cfg_file: src/dataflex/configs/components.yaml
component_name: multimodal_deltaloss
warmup_step: 0
train_step: 500

load_best_model_at_end: false
eval_strategy: "no"
45 changes: 45 additions & 0 deletions examples/train_lora/weighters/multimodal_loss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### Multimodal Loss: s = L(R|Q,I)
# FORCE_TORCHRUN=1 DISABLE_VERSION_CHECK=1 dataflex-cli train examples/train_lora/weighters/multimodal_loss.yaml
model_name_or_path: meta-llama/Llama-3.1-8B
trust_remote_code: true
enable_liger_kernel: false

stage: sft
do_train: true
finetuning_type: lora
lora_target: all
lora_rank: 16
lora_alpha: 8

dataset: alpaca_en_demo
template: llama3
cutoff_len: 2048
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 0
seed: 42

output_dir: ../dataflex_saves/multimodal_loss
logging_steps: 10
save_steps: 100
plot_loss: true
overwrite_output_dir: true
report_to: none

per_device_train_batch_size: 1
gradient_accumulation_steps: 8
learning_rate: 1.0e-4
num_train_epochs: 1.0
lr_scheduler_type: cosine
warmup_ratio: 0.03
bf16: true
ddp_timeout: 180000000

train_type: dynamic_weight
components_cfg_file: src/dataflex/configs/components.yaml
component_name: multimodal_loss
warmup_step: 0
train_step: 500

load_best_model_at_end: false
eval_strategy: "no"
Loading
Loading