Skip to content

Commit e98b8f3

Browse files
justinchubyCopilot
andcommitted
Fix CI: update test to expect ValueError for missing tied keys
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchu@microsoft.com>
1 parent 602e1aa commit e98b8f3

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/mobius/_weight_utils_test.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,13 @@ def test_both_present_no_change(self):
227227
assert sd["model.embed_tokens.weight"].data_ptr() == t1.data_ptr()
228228
assert sd["lm_head.weight"].data_ptr() == t2.data_ptr()
229229

230-
def test_neither_present_no_change(self):
231-
"""If neither present, no change."""
230+
def test_neither_present_raises(self):
231+
"""Raise ValueError if neither key is found (catches key mismatches)."""
232+
import pytest
233+
232234
sd = {"other.weight": torch.randn(4)}
233-
tie_word_embeddings(sd)
234-
assert list(sd.keys()) == ["other.weight"]
235+
with pytest.raises(ValueError, match=r"neither.*found"):
236+
tie_word_embeddings(sd)
235237

236238
def test_custom_keys(self):
237239
"""Custom embed/head keys."""

src/mobius/models/qwen_vl_test.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
from mobius._configs import ArchitectureConfig, VisionConfig
1313
from mobius.models.qwen_vl import (
14-
Qwen25VLCausalLMModel,
15-
Qwen25VLDecoderModel,
1614
Qwen3VL3ModelCausalLMModel,
1715
Qwen3VLDecoderModel,
16+
Qwen25VLCausalLMModel,
17+
Qwen25VLDecoderModel,
1818
)
1919

2020
# Tiny config for weight preprocessing tests (no graph build needed)
@@ -122,7 +122,8 @@ class TestQwen3VL3ModelCausalLMModelTiedWeights:
122122

123123
def test_lm_head_present_when_tied(self):
124124
config = dataclasses.replace(
125-
_BASE_CONFIG, model_type="qwen3_vl",
125+
_BASE_CONFIG,
126+
model_type="qwen3_vl",
126127
)
127128
model = Qwen3VL3ModelCausalLMModel(config)
128129
sd = _fake_state_dict_qwen3vl()
@@ -132,7 +133,8 @@ def test_lm_head_present_when_tied(self):
132133

133134
def test_lm_head_shares_data_ptr_with_embed(self):
134135
config = dataclasses.replace(
135-
_BASE_CONFIG, model_type="qwen3_vl",
136+
_BASE_CONFIG,
137+
model_type="qwen3_vl",
136138
)
137139
model = Qwen3VL3ModelCausalLMModel(config)
138140
sd = _fake_state_dict_qwen3vl()
@@ -148,7 +150,8 @@ class TestQwen3VLDecoderModelTiedWeights:
148150

149151
def test_lm_head_present_when_tied(self):
150152
config = dataclasses.replace(
151-
_BASE_CONFIG, model_type="qwen3_vl",
153+
_BASE_CONFIG,
154+
model_type="qwen3_vl",
152155
)
153156
model = Qwen3VLDecoderModel(config)
154157
sd = _fake_state_dict_qwen3vl()
@@ -158,7 +161,8 @@ def test_lm_head_present_when_tied(self):
158161

159162
def test_lm_head_shares_data_ptr_with_embed(self):
160163
config = dataclasses.replace(
161-
_BASE_CONFIG, model_type="qwen3_vl",
164+
_BASE_CONFIG,
165+
model_type="qwen3_vl",
162166
)
163167
model = Qwen3VLDecoderModel(config)
164168
sd = _fake_state_dict_qwen3vl()

0 commit comments

Comments
 (0)