Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/mcore_bridge/bridge/gpt_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 '
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a minor formatting issue in the warning message. The period for --merge_lora true should be outside the backticks, and a space is needed before the next sentence for better readability.

Suggested change
'methods, LoRA weights may not be available for inference. It is recommended to set '
'methods, LoRA weights may not be available for inference. It is recommended to set `--merge_lora true`. '

'`--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
Expand Down Expand Up @@ -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 '
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 --merge_lora true, and a space is needed before the next sentence.

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

'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
Expand Down
Loading