Skip to content
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

Merged
merged 12 commits into from
Dec 1, 2024
Merged

update llm finetune methods #44

merged 12 commits into from
Dec 1, 2024

Conversation

tanganke
Copy link
Owner

No description provided.

@tanganke tanganke changed the title merge develop into main update llm finetune mesthods Dec 1, 2024
@tanganke tanganke changed the title update llm finetune mesthods update llm finetune methods Dec 1, 2024
@tanganke tanganke marked this pull request as ready for review December 1, 2024 10:33
@tanganke tanganke requested a review from Copilot December 1, 2024 10:33
Copy link
Contributor

@Copilot Copilot AI left a 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, "")`?
Copy link
Preview

Copilot AI Dec 1, 2024

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.

Suggested change
# ? 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.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
def bradly_terry_rm_collate(
batch: List[Dict[str, List[int]]],
pad_token_id: int = 0,
padding_side="right",
Copy link
Preview

Copilot AI Dec 1, 2024

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.

Suggested change
padding_side="right",
padding_side=None,

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -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(
Copy link
Preview

Copilot AI Dec 1, 2024

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.

Suggested change
def bradly_terry_rm_collate(
def bradley_terry_rm_collate(

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@tanganke tanganke requested a review from Copilot December 1, 2024 10:38
Copy link
Contributor

@Copilot Copilot AI left a 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),
Copy link
Preview

Copilot AI Dec 1, 2024

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.

Suggested change
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.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
)
if self.max_epochs > 0:
self._expected_total_steps.append(
len(train_dataloader) * self.max_epochs // self.accumulate_grad_batches
Copy link
Preview

Copilot AI Dec 1, 2024

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.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
[torch.tensor(x["input_ids"]) for x in converted_batch],
batch_first=True,
padding_value=pad_token_id,
padding_side=padding_side,
Copy link
Preview

Copilot AI Dec 1, 2024

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.

Suggested change
padding_side=padding_side,
padding_value=pad_token_id,

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
[torch.tensor(x["attention_mask"]) for x in converted_batch],
batch_first=True,
padding_value=0,
padding_side=padding_side,
Copy link
Preview

Copilot AI Dec 1, 2024

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.

Suggested change
padding_side=padding_side,
padding_value=0,

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@tanganke tanganke merged commit a4847b1 into main Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant