Skip to content

[model] feat: Add text-only Qwen3.5 bridges (port from upstream main) - #18

Merged
yushengsu-thu merged 1 commit into
bridgefrom
qwen35-text-bridge
Jul 8, 2026
Merged

[model] feat: Add text-only Qwen3.5 bridges (port from upstream main)#18
yushengsu-thu merged 1 commit into
bridgefrom
qwen35-text-bridge

Conversation

@yushengsu-thu

Copy link
Copy Markdown
Collaborator

What

Port the text-only Qwen3.5 bridges from NVIDIA-NeMo/Megatron-Bridge main (bfc4b418) to this branch:

  • src/megatron/bridge/models/qwen/qwen35_bridge.pyQwen35Bridge (Qwen3_5ForCausalLM) and Qwen35MoEBridge (Qwen3_5MoeForCausalLM) → GPTModel, ported verbatim
  • src/megatron/bridge/models/qwen/__init__.py — registration import
  • tests/unit_tests/models/qwen/test_qwen35_bridge.py — upstream unit tests, ported verbatim

Why

This branch only registers the VL-native Qwen3_5(Moe)ForConditionalGeneration bridges (qwen_vl/qwen35_vl_bridge.py), so a text-only Qwen3.5 checkpoint cannot be bridged at allAutoBridge finds no match for Qwen3_5ForCausalLM / Qwen3_5MoeForCausalLM. Upstream main added these text bridges (the VL bridge derives from them there); this PR closes the gap for text-only LoRA/RL work.

Compatibility notes

  • All mapping classes the ported file imports (GDNLinearMappingSeparate, GDNConv1dMapping, FusedExpertMapping, FusedGatedExpertMapping, ...) and transformers_compat.full_attention_interval_from_hf already exist on this branch — zero shared-code changes.
  • The base MegatronModelBridge.provider_bridge() used via super() exists on this branch.
  • Top-level from transformers import Qwen3_5ForCausalLM, Qwen3_5MoeForCausalLM matches the existing pattern (qwen3_next_bridge.py); verified importable on transformers 5.8.1 (the miles image environment).

Validation

  • ruff check clean on changed files
  • Runtime check in the miles training environment (transformers 5.8.1): module import + bridge registration OK
  • pytest tests/unit_tests/models/qwen/test_qwen35_bridge.py38 passed

Port qwen35_bridge.py and its unit tests verbatim from
NVIDIA-NeMo/Megatron-Bridge main (bfc4b41). Registers
Qwen3_5ForCausalLM and Qwen3_5MoeForCausalLM -> GPTModel
(model_type qwen3_5_text / qwen3_5_moe_text); this branch
previously only had the VL-native ForConditionalGeneration
bridges, so text-only Qwen3.5 checkpoints could not be bridged.

All referenced mapping classes (GDNLinearMappingSeparate,
GDNConv1dMapping, FusedExpertMapping, ...) and the
full_attention_interval_from_hf helper already exist on this
branch; no shared-code changes needed.

Signed-off-by: Yusheng Su <yushengsu.thu@gmail.com>
Copilot AI review requested due to automatic review settings July 8, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yushengsu-thu
yushengsu-thu merged commit 200aae9 into bridge Jul 8, 2026
4 checks passed
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