diff options
| author | wuhei <wuhei@users.noreply.github.com> | 2026-11-19 12:38:24 +0100 |
|---|---|---|
| committer | wuhei <wuhei@users.noreply.github.com> | 2026-11-19 12:38:24 +0100 |
| commit | a5b77eb48974cfae45bac65ceb4880752444eb47 (patch) | |
| tree | a71b85b54273a2d7893b90acfab43f52325e5db2 /scripts | |
| parent | 10ee627143419d6e9c9186fbb0a023a34b08948e (diff) | |
| download | lilchinese-a5b77eb48974cfae45bac65ceb4880752444eb47.tar.gz | |
english subtitles from a local translation model
Optional second line under the Chinese, translated on the machine:
- -translate-model spawns llama-server (free port, /health wait, SIGTERM on exit)
and uses Hy-MT2-1.8B (Tencent Hunyuan MT) — a dedicated zh→en model, 30 tok/s
on CPU, so a phrase lands in 0.5-0.8s
- -translate points at an already running OpenAI-compatible endpoint (ollama,
LM Studio, llama-server)
- the English line is sticky rather than tied to the 9 characters on screen: no
LLM can keep up with a slide that lives 0.3s, so the translation lags by about
one model call and never blanks between phrases
- -translate-window (28 chars) trades context for latency; translations cached
- phrase text is debounced 200ms and coalesced latest-wins so growth does not
queue up dozens of requests
- display reserves the English line only when translation is enabled, so the
Chinese layout is unchanged without it; autofit now fits both lines
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/fetch-mt-model.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/fetch-mt-model.sh b/scripts/fetch-mt-model.sh new file mode 100755 index 0000000..674899e --- /dev/null +++ b/scripts/fetch-mt-model.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Optional: local English subtitles. Hy-MT2-1.8B (Tencent Hunyuan MT, Q4_K_M, ~1.1 GB) +# is a dedicated translation model — small, fast, and much better on short fragments +# than a general chat model. Needs llama-server (llama.cpp) on PATH. +set -eu +dest=${1:-models/mt} +name=Hy-MT2-1.8B-Q4_K_M.gguf +base=https://huggingface.co/tencent/Hy-MT2-1.8B-GGUF/resolve/main +mkdir -p "$dest" +if [ -f "$dest/$name" ]; then + echo "already have $dest/$name" + exit 0 +fi +echo "downloading $name (~1.1 GB)" +curl -L --fail -C - -o "$dest/$name" "$base/$name" +ls -la "$dest/$name" |
