-
Notifications
You must be signed in to change notification settings - Fork 11
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
update llm finetune methods #44
Conversation
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.
Copilot reviewed 13 out of 28 changed files in this pull request and generated 3 suggestions.
Files not reviewed (15)
- examples/lm_finetune/llama_fullfinetune.sh: Language not supported
- examples/lm_finetune/llama_reward_modeling.sh: Language not supported
- examples/lm_finetune/create_reward_model.ipynb: Evaluated as low risk
- fusion_bench/dataset/llama/init.py: Evaluated as low risk
- fusion_bench/mixins/init.py: Evaluated as low risk
- config/modelpool/SeqenceClassificationModelPool/llama_preference700k.yaml: Evaluated as low risk
- config/method/lm_finetune/bradly_terry_rm.yaml: Evaluated as low risk
- fusion_bench/mixins/fabric_training.py: Evaluated as low risk
- fusion_bench/method/lm_finetune/fullfinetune_sft.py: Evaluated as low risk
- fusion_bench/modelpool/init.py: Evaluated as low risk
- fusion_bench/method/lm_finetune/init.py: Evaluated as low risk
- fusion_bench/modelpool/causal_lm/causal_lm.py: Evaluated as low risk
- fusion_bench/method/init.py: Evaluated as low risk
- config/method/lm_finetune/fullfinetune_sft.yaml: Evaluated as low risk
- fusion_bench/dataset/llama/alpaca.py: Evaluated as low risk
Comments skipped due to low confidence (2)
fusion_bench/dataset/llama/preference_700k.py:59
- Ensure that
rank_zero_only
is properly initialized or imported to avoid potential runtime errors.
if cache_path is not None and rank_zero_only.rank == 0:
fusion_bench/modelpool/seq_classification_lm/init.py:2
- The class name 'SeqenceClassificationModelPool' is misspelled. It should be 'SequenceClassificationModelPool'.
from .seq_classification_lm import SeqenceClassificationModelPool
|
||
def tokenize(sample): | ||
|
||
# ? is it necessary to `.replace(tokenizer.bos_token, "")`? |
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.
[nitpick] The comment contains a question which might be confusing. It should be revised to provide clear information.
# ? is it necessary to `.replace(tokenizer.bos_token, "")`? | |
# Remove the beginning-of-sequence token from the tokenized text |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
def bradly_terry_rm_collate( | ||
batch: List[Dict[str, List[int]]], | ||
pad_token_id: int = 0, | ||
padding_side="right", |
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.
The padding_side
argument is not valid for the pad_sequence
function and should be removed.
padding_side="right", | |
padding_side=None, |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
@@ -64,3 +64,57 @@ def padded_collate_sft( | |||
collated_batch[key] = [x[key] for x in batch] | |||
|
|||
return collated_batch | |||
|
|||
|
|||
def bradly_terry_rm_collate( |
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.
The function name bradly_terry_rm_collate
should be corrected to bradley_terry_rm_collate
.
def bradly_terry_rm_collate( | |
def bradley_terry_rm_collate( |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
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.
Copilot reviewed 13 out of 28 changed files in this pull request and generated 4 suggestions.
Files not reviewed (15)
- examples/lm_finetune/llama_fullfinetune.sh: Language not supported
- examples/lm_finetune/llama_reward_modeling.sh: Language not supported
- examples/lm_finetune/create_reward_model.ipynb: Evaluated as low risk
- fusion_bench/dataset/llama/init.py: Evaluated as low risk
- config/modelpool/SeqenceClassificationModelPool/llama_preference700k.yaml: Evaluated as low risk
- fusion_bench/dataset/llama/alpaca.py: Evaluated as low risk
- fusion_bench/modelpool/seq_classification_lm/init.py: Evaluated as low risk
- fusion_bench/dataset/llama/metamathqa.py: Evaluated as low risk
- fusion_bench/modelpool/causal_lm/causal_lm.py: Evaluated as low risk
- fusion_bench/method/lm_finetune/init.py: Evaluated as low risk
- fusion_bench/method/init.py: Evaluated as low risk
- config/method/lm_finetune/fullfinetune_sft.yaml: Evaluated as low risk
- fusion_bench/mixins/init.py: Evaluated as low risk
- fusion_bench/method/lm_finetune/peftfinetune_sft.py: Evaluated as low risk
- fusion_bench/modelpool/init.py: Evaluated as low risk
Comments skipped due to low confidence (1)
fusion_bench/dataset/llama/preference_700k.py:41
- [nitpick] The comment questioning the necessity of replacing the
bos_token
is ambiguous. Please clarify or remove it if it's not needed.
# ? is it necessary to `.replace(tokenizer.bos_token, "")`?
os.symlink( | ||
save_path, | ||
os.path.join(self.log_dir, "checkpoints", "latest_model.ckpt"), | ||
os.path.isdir(save_path), |
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.
The os.path.isdir(save_path)
check is incorrect. The save_path
is a file path, not a directory path. This should be removed.
os.path.isdir(save_path), | |
os.path.join(self.log_dir, 'checkpoints', 'latest_model.ckpt') |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
) | ||
if self.max_epochs > 0: | ||
self._expected_total_steps.append( | ||
len(train_dataloader) * self.max_epochs // self.accumulate_grad_batches |
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.
The compute_expected_total_steps
method should account for the case when self.accumulate_grad_batches
is 0 to avoid division by zero errors.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
[torch.tensor(x["input_ids"]) for x in converted_batch], | ||
batch_first=True, | ||
padding_value=pad_token_id, | ||
padding_side=padding_side, |
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.
The pad_sequence
function does not support the padding_side
parameter. This will cause a runtime error. Please remove the padding_side
parameter from the pad_sequence
calls.
padding_side=padding_side, | |
padding_value=pad_token_id, |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
[torch.tensor(x["attention_mask"]) for x in converted_batch], | ||
batch_first=True, | ||
padding_value=0, | ||
padding_side=padding_side, |
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.
The pad_sequence
function does not support the padding_side
parameter. This will cause a runtime error. Please remove the padding_side
parameter from the pad_sequence
calls.
padding_side=padding_side, | |
padding_value=0, |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
No description provided.