Skip to content

[Bugfix] glm4v_moe bridge: import GPTModelProvider instead of removed Qwen3MoEModelProvider - #92

Merged
CalvinXKY merged 1 commit into
mainfrom
sync-slime-1979-glm4v-bridge
May 31, 2026
Merged

[Bugfix] glm4v_moe bridge: import GPTModelProvider instead of removed Qwen3MoEModelProvider#92
CalvinXKY merged 1 commit into
mainfrom
sync-slime-1979-glm4v-bridge

Conversation

@aoshen02

Copy link
Copy Markdown
Collaborator

What

slime_plugins/megatron_bridge/glm4v_moe.py hard-imports Qwen3MoEModelProvider from megatron.bridge.models.qwen.qwen_provider. That symbol only existed in the old fzyzcjy@dev_rl bridge fork (0.4.0rc0). It was removed/relocated in bridge 0.5.0 (radixark @bridge — what the current docker/Dockerfile pins, and what vime-vllm-r3:test ships).

Because slime_plugins/megatron_bridge/__init__.py eagerly imports this module, on a 0.5.0 image the ModuleNotFoundError crashes the whole job at startup — even for non-GLM models that never touch this bridge.

Fix

Switch the base class from the removed Qwen3MoEModelProvider to the stable GPTModelProvider (megatron.bridge.models.gpt_provider), and inline the MoE/TransformerConfig fields that the Qwen3 provider used to supply (normalization="RMSNorm", add_bias_linear=False, hidden_dropout=0.0, autocast_dtype, moe_token_dispatcher_type="alltoall", moe_permute_fusion=True).

This mirrors upstream slime's fix (slime #1979, commit acac6616). After this change glm4v_moe.py is byte-identical to slime HEAD.

Why this lever (not a Dockerfile revert)

Reverting the bridge pin to fzyzcjy would make the import resolve but reintroduces the Qwen3-VL weight-sync linear_proj KeyError that 0.5.0 fixes. The correct fix is in code, on the stable base class.

Test

  • py_compile passes.
  • Resulting file is byte-identical to slime upstream HEAD for this module.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Glm4vMoeVLModelProvider to inherit from GPTModelProvider instead of Qwen3MoEModelProvider. It also introduces several new configuration parameters for the model and MoE setup, including normalization, bias, dropout, autocast dtype, token dispatcher type, and permute fusion. The reviewer suggests dynamically retrieving the hidden_dropout value from the Hugging Face text_config instead of hardcoding it to 0.0 to ensure custom configuration settings are respected.

normalization="RMSNorm",
gated_linear_unit=True,
add_bias_linear=False,
hidden_dropout=0.0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Instead of hardcoding hidden_dropout=0.0, it is better to retrieve it from the Hugging Face text_config using getattr(text_config, "hidden_dropout", 0.0). This ensures that any custom dropout settings specified in the model configuration are respected during training/fine-tuning.

Suggested change
hidden_dropout=0.0,
hidden_dropout=getattr(text_config, "hidden_dropout", 0.0),

… Qwen3MoEModelProvider

Sync slime acac6616 (#1979) glm4v_moe.py change. Our megatron-bridge is now
radixark@bridge (0.5.0), where megatron.bridge.models.qwen.qwen_provider was
removed; Qwen3MoEModelProvider no longer exists. The eager import in
slime_plugins/megatron_bridge/__init__.py therefore crashed every bridge-mode
job at startup (ModuleNotFoundError), including non-GLM models such as Qwen3-VL.

Switch the base class to the stable megatron.bridge.models.gpt_provider.
GPTModelProvider (present in both radixark and upstream 0.5.0) and set the few
config fields the Qwen base used to supply implicitly (normalization=RMSNorm,
add_bias_linear=False, hidden_dropout=0.0, autocast_dtype,
moe_token_dispatcher_type=alltoall, moe_permute_fusion=True).

vime's file was byte-identical to slime acac6616~1, so this reproduces exactly
that commit's glm4v_moe.py hunks; the file is now byte-identical to slime HEAD.
No Dockerfile change needed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
@aoshen02
aoshen02 force-pushed the sync-slime-1979-glm4v-bridge branch from 4a397e4 to 21f6144 Compare May 31, 2026 02:56
@CalvinXKY

Copy link
Copy Markdown
Collaborator

LGTM

@CalvinXKY
CalvinXKY merged commit 4265f0b into main May 31, 2026
10 of 12 checks passed
momo609 pushed a commit that referenced this pull request Jun 8, 2026
… Qwen3MoEModelProvider (#92)

Sync slime acac6616 (#1979) glm4v_moe.py change. Our megatron-bridge is now
radixark@bridge (0.5.0), where megatron.bridge.models.qwen.qwen_provider was
removed; Qwen3MoEModelProvider no longer exists. The eager import in
slime_plugins/megatron_bridge/__init__.py therefore crashed every bridge-mode
job at startup (ModuleNotFoundError), including non-GLM models such as Qwen3-VL.

Switch the base class to the stable megatron.bridge.models.gpt_provider.
GPTModelProvider (present in both radixark and upstream 0.5.0) and set the few
config fields the Qwen base used to supply implicitly (normalization=RMSNorm,
add_bias_linear=False, hidden_dropout=0.0, autocast_dtype,
moe_token_dispatcher_type=alltoall, moe_permute_fusion=True).

vime's file was byte-identical to slime acac6616~1, so this reproduces exactly
that commit's glm4v_moe.py hunks; the file is now byte-identical to slime HEAD.
No Dockerfile change needed.

Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@aoshen02
aoshen02 deleted the sync-slime-1979-glm4v-bridge branch June 8, 2026 14:17
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