-
Notifications
You must be signed in to change notification settings - Fork 44
[QEff Finetune]: Enable --help for finetune CLI #392
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
Draft
quic-mamta
wants to merge
6
commits into
quic:main
Choose a base branch
from
quic-mamta:add_help
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+335
−199
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d9eefea
Enable --help for finetuning
quic-mamta 4cb6700
Merge branch 'quic:main' into add_help
quic-mamta ff41278
Merge branch 'main' into add_help
quic-mamta b096db1
Merge branch 'main' into add_help
quic-mamta 1ca1ab4
address comments
mamtsing 2587b00
Merge branch 'main' into add_help
quic-mamta 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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# SPDX-License-Identifier: BSD-3-Clause | ||
# | ||
# ----------------------------------------------------------------------------- | ||
|
||
from dataclasses import dataclass | ||
|
||
|
||
|
@@ -16,7 +17,8 @@ class TrainConfig: | |
model_name (str): Name of the pre-trained model to fine-tune (default: "meta-llama/Llama-3.2-1B"). | ||
tokenizer_name (str): Name of the tokenizer (defaults to model_name if None). | ||
run_validation (bool): Whether to run validation during training (default: True). | ||
batch_size_training (int): Batch size for training (default: 1). | ||
train_batch_size (int): Batch size for training (default: 1). | ||
val_batch_size (int): Batch size for validation (default: 1). | ||
context_length (Optional[int]): Maximum sequence length for inputs (default: None). | ||
gradient_accumulation_steps (int): Steps for gradient accumulation (default: 4). | ||
gradient checkpointing (bool): Enable gradient checkpointing to save the memory by compromising the speed. (default: False). | ||
|
@@ -29,17 +31,11 @@ class TrainConfig: | |
weight_decay (float): Weight decay for optimizer (default: 0.0). | ||
gamma (float): Learning rate decay factor (default: 0.85). | ||
seed (int): Random seed for reproducibility (default: 42). | ||
use_fp16 (bool): Use mixed precision training (default: True). | ||
use_autocast (bool): Use autocast for mixed precision (default: True). | ||
val_batch_size (int): Batch size for validation (default: 1). | ||
dataset (str): Dataset name for training (default: "samsum_dataset"). | ||
quic-mamta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
task_type (str): Type of task for which the finetuning is to be done. Options: "generation" and "seq_classification". (default: "generation") | ||
peft_method (str): Parameter-efficient fine-tuning method (default: "lora"). | ||
use_peft (bool): Whether to use PEFT (default: True). | ||
from_peft_checkpoint (str): Path to PEFT checkpoint (default: ""). | ||
output_dir (str): Directory to save outputs (default: "meta-llama-samsum"). | ||
num_freeze_layers (int): Number of layers to freeze (default: 1). | ||
one_qaic (bool): Use single QAIC device (default: False). | ||
save_model (bool): Save the trained model (default: True). | ||
save_metrics (bool): Save training metrics (default: True). | ||
intermediate_step_save (int): Steps between intermediate saves (default: 1000). | ||
|
@@ -50,15 +46,15 @@ class TrainConfig: | |
use_profiler (bool): Enable profiling (default: False). | ||
enable_ddp (bool): Enable distributed data parallel (default: False). | ||
dist_backend (str): Backend for distributed training (default: "cpu:gloo,qaic:qccl,cuda:gloo"). | ||
grad_scaler (bool): Use gradient scaler (default: True). | ||
dump_root_dir (str): Directory for mismatch dumps (default: "meta-llama-samsum-mismatches/step_"). | ||
opByOpVerifier (bool): Enable operation-by-operation verification (default: False). | ||
""" | ||
|
||
model_name: str = "meta-llama/Llama-3.2-1B" | ||
tokenizer_name: str = None # if not passed as an argument, it uses the value of model_name | ||
run_validation: bool = True | ||
batch_size_training: int = 1 | ||
train_batch_size: int = 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we are changing this param, may be an internal announcement is required. SIT team's testing commands might depend on this one. |
||
val_batch_size: int = 1 | ||
context_length: int = None | ||
gradient_accumulation_steps: int = 4 | ||
gradient_checkpointing: bool = False | ||
|
@@ -71,17 +67,11 @@ class TrainConfig: | |
weight_decay: float = 0.0 | ||
gamma: float = 0.85 # multiplicatively decay the learning rate by gamma after each epoch | ||
seed: int = 42 | ||
use_fp16: bool = True | ||
use_autocast: bool = True | ||
val_batch_size: int = 1 | ||
dataset = "samsum_dataset" | ||
task_type = "generation" # "generation" / "seq_classification" | ||
peft_method: str = "lora" | ||
use_peft: bool = True # use parameter efficient fine tuning | ||
from_peft_checkpoint: str = "" # if not empty and use_peft=True, will load the peft checkpoint and resume the fine-tuning on that checkpoint | ||
from_peft_checkpoint: str = "" # if not empty and peft_method='lora', will load the peft checkpoint and resume the fine-tuning on that checkpoint | ||
output_dir: str = "meta-llama-samsum" | ||
num_freeze_layers: int = 1 | ||
one_qaic: bool = False | ||
save_model: bool = True | ||
save_metrics: bool = True # saves training metrics to a json file for later plotting | ||
intermediate_step_save: int = 1000 | ||
|
@@ -102,6 +92,5 @@ class TrainConfig: | |
enable_ddp: bool = False | ||
dist_backend: str = "cpu:gloo,qaic:qccl,cuda:gloo" | ||
|
||
grad_scaler: bool = True | ||
dump_root_dir: str = "meta-llama-samsum-mismatches/step_" | ||
dump_root_dir: str = "mismatches/step_" | ||
opByOpVerifier: bool = 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
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.
Uh oh!
There was an error while loading. Please reload this page.