Skip to content

Commit fbc3370

Browse files
justinchubyCopilot
andcommitted
Match serialized Qwen4Exp epsilon
Pin the exact float32 GGUF representation of the RMS epsilon so the real artifact header passes strict metadata validation. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
1 parent f5340ec commit fbc3370

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/mobius/integrations/gguf/_qwen4_exp.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from dataclasses import dataclass
1111
from typing import Any
1212

13+
import numpy as np
14+
1315
__all__ = [
1416
"QWEN4EXP_GGUF_REPO",
1517
"QWEN4EXP_GGUF_REVISION",
@@ -392,7 +394,7 @@ def validate_qwen4exp_tensor_contract(
392394
"qwen4exp.attention.head_count_kv": 2,
393395
"qwen4exp.attention.key_length": 256,
394396
"qwen4exp.attention.value_length": 256,
395-
"qwen4exp.attention.layer_norm_rms_epsilon": 1e-6,
397+
"qwen4exp.attention.layer_norm_rms_epsilon": float(np.float32(1e-6)),
396398
"qwen4exp.rope.dimension_count": 64,
397399
"qwen4exp.rope.freq_base": 10_000_000.0,
398400
"qwen4exp.full_attention_interval": 4,

‎src/mobius/integrations/gguf/_qwen4_exp_test.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from types import SimpleNamespace
77
from unittest import mock
88

9+
import numpy as np
910
import pytest
1011

1112
from mobius._configs import Qwen4ExpConfig
@@ -53,7 +54,7 @@ def _metadata() -> dict[str, object]:
5354
"qwen4exp.attention.head_count_kv": 2,
5455
"qwen4exp.attention.key_length": 256,
5556
"qwen4exp.attention.value_length": 256,
56-
"qwen4exp.attention.layer_norm_rms_epsilon": 1e-6,
57+
"qwen4exp.attention.layer_norm_rms_epsilon": float(np.float32(1e-6)),
5758
"qwen4exp.rope.dimension_count": 64,
5859
"qwen4exp.rope.dimension_sections": [11, 11, 10],
5960
"qwen4exp.rope.freq_base": 10_000_000.0,
@@ -209,6 +210,10 @@ def test_qwen4exp_header_fixture_proves_exact_three_shard_closure():
209210

210211
_validate_fixture(fixture)
211212

213+
assert (
214+
float(fixture.metadata["qwen4exp.attention.layer_norm_rms_epsilon"]).hex()
215+
== float(np.float32(1e-6)).hex()
216+
)
212217
assert len(fixture.tensor_names) == 1224
213218
assert [shard.tensor_count for shard in fixture.manifest.shards] == [0, 595, 629]
214219
assert sum(shard.tensor_count for shard in fixture.manifest.shards) == 1224

0 commit comments

Comments
 (0)