--- title: Mặc Hi — Chinese→Vietnamese WebGPU Kernels emoji: 🖌️ colorFrom: gray colorTo: red sdk: static pinned: false short_description: Dịch truyện Trung→Việt với custom WebGPU kernels --- # Mặc Hi 墨曦 — dịch truyện Trung→Việt trong trình duyệt Marian NMT (zh→vi) chạy **hoàn toàn trong trình duyệt** trên các WebGPU kernel viết tay bằng WGSL — không dùng ONNX Runtime / WASM cho phần suy luận. **Custom kernels:** fused encoder/decoder attention, GEMM/GEMV f16, int8 LM head (tiled + reduce), RMS/LayerNorm dùng subgroups, mega-kernel decode cho batch nhỏ, autotune routing theo từng GPU (có phát hiện driver miscompile trên Adreno 7xx và tự chuyển sang biến thể subgroup an toàn). **Tính năng:** - 2 model zh→vi (Mặc Hi d448/8×56, Hachimi d576/8×72) — chuyển đổi ngay trong app - Tự động chuyển phồn thể → giản thể (dữ liệu OpenCC) trước khi dịch - Tokenizer SPM-BPE tự viết (không dùng transformers.js) — toàn bộ pipeline tự viết - Batch decode + KV cache, chạy được cả trên GPU điện thoại (Adreno) - PWA: cài như app, dịch **offline** sau lần tải model đầu tiên - Khôi phục sau device-lost, resume giữa chừng, wake lock khi đang dịch **Yêu cầu:** trình duyệt hỗ trợ WebGPU (Chrome/Edge 121+, Chrome Android). Bản chính thức: Cảm hứng trình bày từ các space [gemma-4-webgpu-kernels](https://huggingface.co/spaces/webml-community/gemma-4-webgpu-kernels) và [lfm2-webgpu-kernels](https://huggingface.co/spaces/webml-community/lfm2-webgpu-kernels) của webml-community.