ONNX export (int4 weights, fp16 activations, 1.07 GB) of hsilvosa/feishengmt, a
fine-tune of tencent/Hy-MT2-1.8B for Chinese-to-English translation of
wuxia and xianxia fiction. It is built mainly for English and adapted to answer also in French, Portuguese, Spanish,
Indonesian, Japanese and Korean. Version 1.2 (each release is also a tag of this repository, e.g.
revision: "v1.2"). The export was made with the ONNX Runtime GenAI model builder for the WebGPU
execution provider, so it runs inside a browser tab with transformers.js.
Modified version of Hy-MT2-1.8B, not endorsed by Tencent. Read the main model card for the training, the results and the limits; this file only describes the browser version.
import { pipeline } from "@huggingface/transformers";
const gen = await pipeline("text-generation", "hsilvosa/feishengmt-ONNX", { dtype: "q4f16", device: "webgpu" });
const prompt = "将以下文本翻译为English,注意只需要输出翻译后的结果,不要额外解释:\n\n包公便说:“你好。”";
const out = await gen([{ role: "user", content: prompt }], { max_new_tokens: 500, do_sample: false });
console.log(out[0].generated_text.at(-1).content);
Send whole paragraphs, in windows of up to about 400 characters, and keep the quote marks of the source: the model writes
the quotes of the English text by itself. The language name in the prompt is English or 英语; for the others use
法语, 葡萄牙语, 西班牙语, 印尼语, 日语 or 韩语. The window planner, the checks of the answer and Glossary v2
(175 curated genre terms, non-overlapping span matching, and cultural time-unit rules) live in the Python pipeline/ of
the main repository (and in the browser frontend) and work directly on top of these v1.2 ONNX weights without
re-exporting the model.
The weights are the ones of the GGUF version, quantized in a different way, so the quality is close to it but was not measured separately. It needs a browser with WebGPU.
hsilvosa/feishengmt