Repository navigation
mlx_tf config: refuse an unknown model_type instead of serving it as Qwen3.5 - #6505
Conversation
|
Landed in the same shape as my closed #6504 — this one's coverage is already solid. Two cases from my draft that might be worth adding, if you want them: // model_type in text_config wins over the root's — real Qwen3.5 configs carry "qwen3_5_text" there
const nested = try parse("{\"model_type\":\"qwen3_5\",\"text_config\":{\"model_type\":\"qwen3_5_text\",\"hidden_size\":1024,\"intermediate_size\":2816,\"num_hidden_layers\":4,\"vocab_size\":32000,\"num_attention_heads\":8,\"num_key_value_heads\":4,\"rms_norm_eps\":1e-5}}");
try std.testing.expectEqual(Arch.qwen35_hybrid, nested.arch);
// …and an unknown type hiding in text_config is still refused even when root is recognised
try std.testing.expectError(error.UnsupportedModelType, parse("{\"model_type\":\"qwen3_5\",\"text_config\":{\"model_type\":\"qwen4_moe\",\"hidden_size\":1024,\"intermediate_size\":2816,\"num_hidden_layers\":4,\"vocab_size\":32000,\"num_attention_heads\":8,\"num_key_value_heads\":4,\"rms_norm_eps\":1e-5}}"));
// architectures-array Ergo detection is unaffected by the refusal branch
const ergo = try parse("{\"architectures\":[\"ErgoForCausalLM\"],\"hidden_size\":1024,\"intermediate_size\":2816,\"num_hidden_layers\":4,\"vocab_size\":32000,\"num_attention_heads\":8,\"num_key_value_heads\":4,\"rms_norm_eps\":1e-5}");
try std.testing.expectEqual(Arch.ergo, ergo.arch);The |
|
READY to land on this head. Host-only mlx_tf admission change: unknown model_type values outside the kept aliases and the Ergo override are refused before any weight loads, so a qwen4_moe folder no longer loads silently as a Qwen3.5 hybrid. Every admitted architecture parses as before, the new host test covers both, and no kernel or forward code changes.
|
…Qwen3.5 parseJson defaulted every unrecognised model_type to the Qwen3.5 hybrid; a new architecture then served until a tensor read failed somewhere far from the cause. An unknown type is now refused as UnsupportedModelType up front. qwen3_vl/qwen3_5_vl and their *_text variants (the text towers vision_config admits) count as the hybrid; everything else is refused. Also hoist build.zig's test-filter option: it was declared twice (lines 82/101), which panics zig 0.17 on every build. And register test-config-parse-host: config_json_test.zig checks every recognised model_type maps to its arch, an absent field keeps the hybrid default, and unknown types are refused.
0121138 to
ee0ad03
Compare
|
Thank you @joshuaswarren. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
parseJsonin the mlx_tf engine defaulted any unrecognisedmodel_typeto the Qwen3.5 hybrid; a new architecture then served until a tensor read failed somewhere far from the cause. An unknown type is now refused witherror.UnsupportedModelTypeat load.qwen3_vl,qwen3_5_vland their*_texttext-tower variants — the towersvision_config.zigalready admits — still map to the hybrid; every recognised type is unchanged.atc overlap --json(run 2026-12-05 ~15:59Z against origin/main93f187b13):"overlaps": []— no open pull request touches these files. OneworktreeOverlapsentry flagged "conflicts" on 2 files: that was this same change still carried uncommitted in an older local checkout, since cleaned; no external conflict.Checks on this head
931a1cd04python3 tools/zig/lean_check.py, on the base and on this head: 88 on base, 88 on head, 0 new findings.zig build test-config-parse-host(new step, zig 0.17.0): 3/3 pass on this head. On the merge-base with onlybuild.zigand the test file added, the same step fails 1/3 — the refusal test is red before the change.src/config_json_test.zigasserts every recognisedmodel_typemaps to its arch, an absentmodel_typekeeps the hybrid default,qwen3_vl/qwen3_5_vl/qwen3_vl_text/qwen3_5_vl_textmap to the hybrid, andqwen4_moe/phi4/gpt_ossare refused.zig fmt --checkon all touched files andgit diff --check: clean.zig build test(the full mlx_tf suite) cannot compile on this Linux host — the test binary links Metal/Foundation/objc, and the same failure exists on the base. The host-capable coverage for this path is thetest-config-parse-hoststep; the parser itself is platform-independent.Receipt
model_typevalues produce an identicalModelConfig(the new test asserts the arch mapping for every recognised type and the absent-key default), so there is no arithmetic path to A/B; the only behavioural delta is that configs which previously mis-served until a tensor-read error are refused at load.config.jsonparsing andloadAutoin the mlx_tf engine — every caller ofparseJson..zig-version), no GPU; parse-level tests only.model_typemaps to its previous arch.Checklist
(Inference checklist skipped — this change does not touch the token path.)