Skip to content

Commit e8101a7

Browse files
hychiang-gitclaude
andcommitted
fix: apply ruff formatting to mcore_qwen3vl plugin and test files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Hung-Yueh Chiang <hungyuehc@nvidia.com>
1 parent ff1152f commit e8101a7

3 files changed

Lines changed: 15 additions & 25 deletions

File tree

modelopt/torch/export/plugins/mcore_common.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@
3939
qwen25_causal_lm_export,
4040
qwen25_causal_lm_import,
4141
)
42-
from .mcore_qwen3vl import (
43-
qwen3vl_causal_lm_export,
44-
qwen3vl_causal_lm_import,
45-
)
42+
from .mcore_qwen3vl import qwen3vl_causal_lm_export, qwen3vl_causal_lm_import
4643

4744
all_mcore_hf_export_mapping: dict[str, Any] = {
4845
"DeepseekV2ForCausalLM": deepseek_causal_lm_export,

modelopt/torch/export/plugins/mcore_qwen3vl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@
117117
"local_experts.linear_fc2": NameRemapping(
118118
"model.language_model.layers.{}.mlp.experts.{}.down_proj."
119119
),
120-
}
120+
}

tests/gpu_megatron/torch/export/test_mcore_qwen3vl.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def test_qkv_uses_merging(self):
121121
assert isinstance(qwen3vl_causal_lm_import["linear_qkv"], QKVMerging)
122122

123123
def test_mlp_uses_gated_merging(self):
124-
assert isinstance(
125-
qwen3vl_causal_lm_import["linear_fc1"], GatedMLPMerging
126-
)
124+
assert isinstance(qwen3vl_causal_lm_import["linear_fc1"], GatedMLPMerging)
127125

128126
@pytest.mark.parametrize(
129127
"key",
@@ -192,14 +190,17 @@ def test_qkv_uses_slicing(self):
192190
assert isinstance(qwen3vl_causal_lm_export["linear_qkv"], QKVSlicing)
193191

194192
def test_mlp_uses_gated_slicing(self):
195-
assert isinstance(
196-
qwen3vl_causal_lm_export["linear_fc1"], GatedMLPSlicing
197-
)
193+
assert isinstance(qwen3vl_causal_lm_export["linear_fc1"], GatedMLPSlicing)
198194

199195
def test_export_has_no_parallel_config(self):
200196
"""Export mappings should not have parallel configs."""
201-
for key in ["word_embeddings", "final_layernorm", "output_layer",
202-
"input_layernorm", "linear_proj"]:
197+
for key in [
198+
"word_embeddings",
199+
"final_layernorm",
200+
"output_layer",
201+
"input_layernorm",
202+
"linear_proj",
203+
]:
203204
mapping = qwen3vl_causal_lm_export[key]
204205
assert "parallel_config" not in mapping.func_kwargs
205206

@@ -208,9 +209,7 @@ class TestQwen3VLImportExportSymmetry:
208209
"""Test that import and export mappings are consistent."""
209210

210211
def test_same_mcore_keys(self):
211-
assert set(qwen3vl_causal_lm_import.keys()) == set(
212-
qwen3vl_causal_lm_export.keys()
213-
)
212+
assert set(qwen3vl_causal_lm_import.keys()) == set(qwen3vl_causal_lm_export.keys())
214213

215214
@pytest.mark.parametrize(
216215
"key",
@@ -256,12 +255,8 @@ def test_same_keys_as_qwen3(self):
256255
qwen3_causal_lm_import,
257256
)
258257

259-
assert set(qwen3vl_causal_lm_import.keys()) == set(
260-
qwen3_causal_lm_import.keys()
261-
)
262-
assert set(qwen3vl_causal_lm_export.keys()) == set(
263-
qwen3_causal_lm_export.keys()
264-
)
258+
assert set(qwen3vl_causal_lm_import.keys()) == set(qwen3_causal_lm_import.keys())
259+
assert set(qwen3vl_causal_lm_export.keys()) == set(qwen3_causal_lm_export.keys())
265260

266261
@pytest.mark.parametrize(
267262
"key",
@@ -290,9 +285,7 @@ def test_vl_adds_language_model_prefix(self, key):
290285
qwen3_prefix = qwen3_causal_lm_import[key].target_name_or_prefix
291286
qwen3vl_prefix = qwen3vl_causal_lm_import[key].target_name_or_prefix
292287
expected = qwen3_prefix.replace("model.", "model.language_model.", 1)
293-
assert qwen3vl_prefix == expected, (
294-
f"{key}: expected '{expected}', got '{qwen3vl_prefix}'"
295-
)
288+
assert qwen3vl_prefix == expected, f"{key}: expected '{expected}', got '{qwen3vl_prefix}'"
296289

297290
def test_output_layer_same(self):
298291
"""lm_head is at root level for both Qwen3 and Qwen3-VL."""

0 commit comments

Comments
 (0)