Repository navigation
Add Tencent Hy-MT2-1.8B support (L4/L5 golden + parity example) - #374
Merged
Merged
Conversation
The HunYuanDenseV1 architecture (model_type hunyuan_v1_dense) is already
supported by HunYuanV1DenseCausalLMModel; Hy-MT2-1.8B is the newer (2026.5)
translation checkpoint in that family. This adds verification + a runnable
demo:
- testdata/cases/causal-lm/hy-mt2-1_8b.yaml: L4+L5 case pinned to the model
revision, with the Hy-MT chat-template-formatted translation prompt.
- testdata/golden/causal-lm/hy-mt2-1_8b{,_generation}.json: L4 prefill-logits
and L5 greedy-generation golden references (generated against HF).
- examples/hy_mt2.py: builds the ONNX export, runs greedy generation through
ONNX Runtime AND HuggingFace, and asserts identical token sequences.
Verified: L4+L5 e2e_golden_test pass; the example reproduces HF token-for-token
("The waters of the Yellow River come from the sky").
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Performance Comparison
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds end-to-end (L4/L5) golden coverage and a runnable parity demo for the HuggingFace model tencent/Hy-MT2-1.8B (HunYuanDenseV1), validating that the existing hunyuan_v1_dense support works on real weights without requiring new model/registry code.
Changes:
- Add a new L4+L5 YAML case pinned to a specific model revision, including a chat-template-formatted translation prompt.
- Add L4 prefill-logits and L5 greedy-generation golden JSON artifacts for Hy-MT2-1.8B.
- Add an example script that builds ONNX, runs greedy generation via ORT and HuggingFace, and checks token-level parity.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
testdata/cases/causal-lm/hy-mt2-1_8b.yaml |
New L4+L5 test case spec for Hy-MT2-1.8B (prompt + generation settings). |
testdata/golden/causal-lm/hy-mt2-1_8b.json |
New L4 golden (prefill logits summary + top-k) for Hy-MT2-1.8B. |
testdata/golden/causal-lm/hy-mt2-1_8b_generation.json |
New L5 golden (greedy generation tokens/text) for Hy-MT2-1.8B. |
examples/hy_mt2.py |
New runnable ORT-vs-HF token-parity demo for Hy-MT2-1.8B. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
OnnxGenerator allocated all past_key_values / recurrent-state buffers as float32, so feeding them into an f16/bf16 ONNX export raised an ORT input dtype mismatch — breaking the half-precision CUDA path advertised by the Hy-MT2 example. Resolve each cache input's dtype from the session (get_input_dtype, which maps bf16 via ml_dtypes) and allocate the zero buffers accordingly, falling back to float32 when unknown. Validated: examples/hy_mt2.py --dtype f16 now runs and matches HuggingFace token-for-token; the f32 path is unchanged. Co-authored-by: Copilot <[email protected]> Signed-off-by: Justin Chu <[email protected]>
justinchuby
enabled auto-merge (squash)
June 23, 2026 23:36
justinchuby
disabled auto-merge
June 26, 2026 20:38
justinchuby
added a commit
that referenced
this pull request
Aug 15, 2026
Add an authoritative graph target manifest, PEFT safetensors ingestion with rank and alpha patterns, optional provenance-preserving .onnx_adapter declarations, aligned N-adapter catalogs, and paged-lifecycle reference accounting. Cover PR #318 and #374 migration semantics without freezing the pending ONNX GenAI #828 schema field names. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
justinchuby
added a commit
that referenced
this pull request
Aug 20, 2026
Add an authoritative graph target manifest, PEFT safetensors ingestion with rank and alpha patterns, optional provenance-preserving .onnx_adapter declarations, aligned N-adapter catalogs, and paged-lifecycle reference accounting. Cover PR #318 and #374 migration semantics without freezing the pending ONNX GenAI #828 schema field names. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
justinchuby
added a commit
that referenced
this pull request
Aug 20, 2026
Add an authoritative graph target manifest, PEFT safetensors ingestion with rank and alpha patterns, optional provenance-preserving .onnx_adapter declarations, aligned N-adapter catalogs, and paged-lifecycle reference accounting. Cover PR #318 and #374 migration semantics without freezing the pending ONNX GenAI #828 schema field names. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
justinchuby
added a commit
that referenced
this pull request
Aug 21, 2026
Add an authoritative graph target manifest, PEFT safetensors ingestion with rank and alpha patterns, optional provenance-preserving .onnx_adapter declarations, aligned N-adapter catalogs, and paged-lifecycle reference accounting. Cover PR #318 and #374 migration semantics without freezing the pending ONNX GenAI #828 schema field names. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support + verification for
tencent/Hy-MT2-1.8B, the newer (2026.5) multilingual translation checkpoint in the HunYuanDenseV1 family (model_type: hunyuan_v1_dense).The architecture is already supported by
HunYuanV1DenseCausalLMModel(GQA 16/4 heads, head_dim 128, per-head QK-norm, tied embeddings, dynamic-NTK RoPE withalpha=1000viaDynamicNTKRope). No model/registry code changes were needed — this PR adds the test coverage and a runnable demo that prove it works end-to-end on the real weights.Changes
testdata/cases/causal-lm/hy-mt2-1_8b.yaml— L4+L5 case, pinned to the model revision, with the Hy-MT chat-template-formatted translation prompt.testdata/golden/causal-lm/hy-mt2-1_8b.json+...-1_8b_generation.json— L4 prefill-logits and L5 greedy-generation goldens (generated against HFtransformers).examples/hy_mt2.py— builds the ONNX export, runs greedy generation through ONNX Runtime and HuggingFace, and asserts the two produce identical token sequences.Validation
pytest tests/e2e_golden_test.py -m "golden or generation" -k hy_mt2→ 2 passed (L4 prefill logits + L5 greedy generation match HF).examples/hy_mt2.pyreproduces HF token-for-token:hunyuan_v1_denseunit tests pass; lint clean.Co-authored-by: Copilot [email protected]