Hy-MT3-1.8B-ONNX (q4f16)
ONNX build of tencent/Hy-MT3-1.8B for Transformers.js, running on WebGPU.
Usage (Transformers.js)
import { pipeline } from "@huggingface/transformers";
const generator = await pipeline("text-generation", "konstbet/Hy-MT3-1.8B-ONNX", {
dtype: "q4f16",
device: "webgpu",
});
const messages = [
{
role: "user",
content:
"Translate the following text into Chinese. Note that you should only output the translated result without any additional explanation:\n\nIt's on the house.",
},
];
const output = await generator(messages, { max_new_tokens: 256, do_sample: false });
console.log(output[0].generated_text.at(-1).content);
Conversion details
Built with the ONNX Runtime GenAI model builder (
onnxruntime-genai0.17.1), which has native support forHunYuanDenseV1ForCausalLM:python -m onnxruntime_genai.models.builder \ -m tencent/Hy-MT3-1.8B -o out -p int4 -e webgpuFused operators:
GroupQueryAttention,RotaryEmbedding,SimplifiedLayerNormalization/SkipSimplifiedLayerNormalization,MatMulNBits(4-bit,block_size=32,accuracy_level=4) andGatherBlockQuantizedfor the token embedding. Scales are float16.The
kv_cache_dimsymbolic dimension onpast_key_values.*inputs andpresent.*outputs was set to the static head dimension (128) so Transformers.js can construct the empty cache on the first decoding pass.Hy-MT3 ships its chat template as a standalone
chat_template.jinja; it is also embedded intokenizer_config.jsonbecause Transformers.js reads the template from there only.config.jsoncarriestransformers.js_configwithuse_external_data_format(one data chunk) andkv_cache_dtype(float16).
License
Apache-2.0, inherited from tencent/Hy-MT3-1.8B.