Skip to content

fix: convert grouped-expert fc1 bias together with its FP8 scale - #227

Open
shiaho777 wants to merge 1 commit into
modelscope:mainfrom
shiaho777:fix/expert-fc1-bias-with-scale
Open

shiaho777 wants to merge 1 commit into
modelscope:mainfrom
shiaho777:fix/expert-fc1-bias-with-scale

Conversation

@shiaho777

Copy link
Copy Markdown
Contributor

Loading linear_fc1 for local experts aborted when add_bias_linear and a block scale were both set. The weight path already reads gate_up_proj_scale_inv, and the bias path already copies gate_up_proj_bias with hf_scale_inv left empty. The assert was the only thing keeping the two apart. Export already writes the bias and the scale as separate tensors.

The assert now only requires a local expert. A non-expert fc1 bias is still refused, because that layout is not converted here.

flake8 is clean on gpt_bridge.py.

Loading linear_fc1 for local experts aborted when add_bias_linear and a block scale were both set. The weight path already reads gate_up_proj_scale_inv, and the bias path already copies gate_up_proj_bias with hf_scale_inv left empty. The assert was the only thing keeping the two apart. Export already writes the bias and the scale as separate tensors.

The assert now only requires a local expert. A non-expert fc1 bias is still refused, because that layout is not converted here.

flake8 is clean on gpt_bridge.py.
@hjh0119

hjh0119 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Which model actually encountered this issue?

@shiaho777

Copy link
Copy Markdown
Contributor Author

No separate checkpoint. The abort is the assert in _set_mlp_state for grouped local experts when add_bias_linear and a *_scale_inv tensor are both present. In that same block, gpt_oss is the model type that then splits gate_up_proj_bias. The weight scale was already loaded. The bias copy was already written and never ran, because the assert required not has_scale_inv. A non-expert fc1 bias is still refused.

@shiaho777

Copy link
Copy Markdown
Contributor Author

The PR does not name a checkpoint. The abort is the local-expert linear_fc1 path when add_bias_linear and a block scale are both set: the weight path already reads gate_up_proj_scale_inv, and the bias path copies gate_up_proj_bias with hf_scale_inv left empty. The assert was the only thing keeping those two apart. A non-expert fc1 bias is still refused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants