-
Notifications
You must be signed in to change notification settings - Fork 14
remove hf_grouped lora error #75
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,6 +46,7 @@ class GPTBridge: | |||||
| hf_expert_bias_key = 'gate.e_score_correction_bias' | ||||||
| additional_dim0_keys = set() | ||||||
| additional_dim1_keys = set() | ||||||
| _support_hf_grouped_lora = True | ||||||
|
|
||||||
| def __init__(self, config: ModelConfig): | ||||||
| self.config = config | ||||||
|
|
@@ -938,9 +939,11 @@ def _set_mlp_state( | |||||
| dist.all_reduce(is_lora, group=self.pp_group) | ||||||
| if is_lora: | ||||||
| if hf_grouped: | ||||||
| raise ValueError('Since this model\'s transformers and megatron have different expert ' | ||||||
| 'weight organization methods, LoRA weight conversion is not supported. ' | ||||||
| 'You can solve this issue by setting `--merge_lora true`.') | ||||||
| logger.warning_once( | ||||||
| 'Since this model\'s transformers and megatron have different expert weight organization ' | ||||||
| 'methods, LoRA weights may not be available for inference. It is recommended to set ' | ||||||
| '`--merge_lora true`. You can also manually merge LoRA weights using the ' | ||||||
| '`megatron export` command.') | ||||||
| if mg_mlp is None: | ||||||
| lora_A = None | ||||||
| lora_B = None | ||||||
|
|
@@ -1166,9 +1169,11 @@ def _set_mlp_state( | |||||
| dist.all_reduce(is_lora, group=self.pp_group) | ||||||
| if is_lora: | ||||||
| if hf_grouped: | ||||||
| raise ValueError('Since this model\'s transformers and megatron have different expert ' | ||||||
| 'weight organization methods, LoRA weight conversion is not supported. ' | ||||||
| 'You can solve this issue by setting `--merge_lora true`.') | ||||||
| logger.warning_once( | ||||||
| 'Since this model\'s transformers and megatron have different expert weight organization ' | ||||||
|
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. This warning message is duplicated from earlier in the function (around line 944). To improve maintainability, consider extracting the message into a shared constant. Additionally, this instance has the same formatting issue as the first one: the period should be outside the backticks for
Suggested change
|
||||||
| 'methods, LoRA weights may not be available for inference. It is recommended to set ' | ||||||
| '`--merge_lora true`. You can also manually merge LoRA weights using the ' | ||||||
| '`megatron export` command.') | ||||||
| if mg_mlp is None: | ||||||
| lora_A = None | ||||||
| lora_B = None | ||||||
|
|
||||||
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.
There's a minor formatting issue in the warning message. The period for
--merge_lora trueshould be outside the backticks, and a space is needed before the next sentence for better readability.