-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update fineune_sft for llama * add peft finetune method
- Loading branch information
Showing
6 changed files
with
539 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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,18 @@ | ||
defaults: | ||
- loggers: tensorboard_logger | ||
- _self_ | ||
|
||
_target_: lightning.Fabric | ||
_recursive_: true | ||
# Number of devices to train on (``int``), which GPUs to train on (``list`` or ``str``), or ``"auto"``. | ||
# The value applies per node. | ||
devices: auto | ||
# Strategy for how to run across multiple devices. Possible choices are: | ||
# ``"dp"``, ``"ddp"``, ``"ddp_spawn"``, ``"deepspeed"``, ``"fsdp"``. | ||
strategy: ddp | ||
# The hardware to run on. Possible choices are: | ||
# ``"cpu"``, ``"cuda"``, ``"mps"``, ``"gpu"``, ``"tpu"``, ``"auto"``. | ||
# for example: fabric.accelerator=cpu | ||
accelerator: auto | ||
# reference to the precision policy: https://lightning.ai/docs/fabric/stable/api/fabric_args.html#precision | ||
precision: bf16-true |
This file contains 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,55 @@ | ||
_target_: ttt.method.FullFinetuneSFT | ||
_recursive_: False | ||
|
||
optimizer: | ||
_target_: torch.optim.AdamW | ||
fused: True | ||
weight_decay: 0.01 | ||
lr: 5e-5 | ||
|
||
lr_scheduler: | ||
_target_: torchtune.training.lr_schedulers.get_cosine_schedule_with_warmup | ||
num_warmup_steps: 5 | ||
num_training_steps: _T_max_ # this will be replaced by the expected number of training steps | ||
|
||
dataloader_kwargs: | ||
# per-gpu batch size | ||
batch_size: 1 | ||
num_workers: 0 | ||
pin_memory: True | ||
|
||
peft_config: | ||
_target_: peft.LoraConfig | ||
task_type: peft.TaskType.CAUSAL_LM | ||
target_modules: | ||
- query | ||
- value | ||
r: 16 | ||
lora_alpha: 16 | ||
lora_dropout: 0 | ||
bais: none | ||
|
||
adapter_name: default | ||
# whether to merge and unload the adapter after training | ||
merge_and_unload: false | ||
|
||
# Training hyperparameters | ||
# if max_epochs=-1, max_steps will be used to determine the number of training steps | ||
max_epochs: 3 | ||
max_steps: -1 | ||
max_steps_per_epoch: -1 | ||
accumulate_grad_batches: 1 | ||
lr_scheduler_interval: step | ||
lr_scheduler_frequency: 1 | ||
# Checkpointing may be done by epoch or step, and at the end of training | ||
# `checkpoint_save_interval` can be 'epoch' or 'step' | ||
checkpoint_save_interval: epoch | ||
checkpoint_save_frequency: 1 | ||
# Whether to use gradient clipping, and if so, the value and algorithm | ||
gradient_clip_val: null | ||
gradient_clip_algorithm: norm | ||
save_optimizer_state: false | ||
# save_full_model must be true when using shared FSDP | ||
save_full_model: false | ||
# Path to checkpoint to load from, used for resuming training | ||
ckpt_path: null |
This file contains 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 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
from .fullfinetune_sft import FullFinetuneSFT | ||
from .peftfinetune_sft import PeftFinetuneSFT |
This file contains 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.