An offline machine translation tool powered by Tencent Hy-MT2 1.8B Q4_K_M GGUF that translates video SRT subtitle files across 33 languages while preserving exact timestamp bounds, sequence formatting, and terminology rules.
| 📥 Step 1: Input | ⚡ Step 2: AI Action | 📤 Step 3: Result |
|---|---|---|
Load English .srt video subtitle file from inputs/ directory. |
Hy-MT2 1.8B GGUF model translates text while locking timestamps. | Frame-perfect translated .srt subtitles exported to outputs/ folder. |
- Translation Engine: Tencent Hy-MT2 1.8B Q4_K_M GGUF (
Hy-MT2-1.8B-Q4_K_M.ggufvia Ollama) - Model Source: Tencent Hy-MT2 1.8B GGUF on Hugging Face
- Runtime Environment: Python 3.10+ & Ollama
- Supported Formats: SRT Video Subtitle Files, JSON, Plain Text
- Languages Supported: 33 Languages (English, Hindi, Spanish, French, German, Japanese, etc.)
Download the official Hy-MT2-1.8B-Q4_K_M.gguf file into the models/ directory:
mkdir models -Force
Invoke-WebRequest -Uri "https://huggingface.co/tencent/Hy-MT2-1.8B-GGUF/resolve/main/Hy-MT2-1.8B-Q4_K_M.gguf" -OutFile "models/Hy-MT2-1.8B-Q4_K_M.gguf"(Alternatively, download manually from Hugging Face Hy-MT2-1.8B-GGUF and place the file in models/Hy-MT2-1.8B-Q4_K_M.gguf)
The root Modelfile is pre-configured for the Hy-MT2-1.8B-Q4_K_M.gguf weight file:
FROM ./models/Hy-MT2-1.8B-Q4_K_M.gguf
PARAMETER temperature 0.7
PARAMETER top_p 0.6
PARAMETER top_k 20
PARAMETER repetition_penalty 1.05
PARAMETER num_predict 4096
Run this command in PowerShell to build and register the model tag in local Ollama:
ollama create hy-mt2-1.8b-q4 -f ModelfileTo run batch translation into Hindi and Spanish using the local hy-mt2-1.8b-q4 GGUF model:
python main.py --input inputs/subtitles_en.srt --model hy-mt2-1.8b-q4To translate into a specific language (e.g., Hindi):
python main.py --input inputs/subtitles_en.srt --lang Hindi --code hi --model hy-mt2-1.8b-q4To translate into Spanish:
python main.py --input inputs/subtitles_en.srt --lang Spanish --code es --model hy-mt2-1.8b-q4.
├── inputs/
│ └── subtitles_en.srt
├── models/
│ └── Hy-MT2-1.8B-Q4_K_M.gguf
├── outputs/
│ ├── subtitles_hi.srt
│ ├── subtitles_es.srt
│ └── metrics.md
├── main.py
├── Modelfile
├── requirements.txt
└── README.md
main.py: Core Python script that parses SRT structure, querieshy-mt2-1.8b-q4via Ollama, and exports localized.srtfiles andmetrics.md.Modelfile: Configures token sampling parameters and points to./models/Hy-MT2-1.8B-Q4_K_M.gguf.inputs/subtitles_en.srt: Input video subtitle file containing timing bounds and text blocks.outputs/metrics.md: Automatically generated performance and execution metrics report.
- Automated YouTube Video Localization: Offline translation of video subtitle scripts for global YouTube channel reach.
- Software UI File Translation: Translates user-facing JSON UI values while preserving code key names and placeholders.
- Markdown Documentation Engine: Translates GitHub project README files without breaking markdown tables or code syntax.
- Offline Desktop Subtitle Helper: Runs locally on low-spec PCs without internet connectivity using ~1.15GB VRAM/RAM.
- Private Enterprise Document Translation: Translates sensitive business documents locally with zero cloud data transmission.
- Automatic VTT & ASS Format Support: Expand subtitle parser to support WebVTT and Advanced SubStation Alpha formats.
- Audio Waveform Auto-Alignment: Integrate Whisper automatic speech recognition to re-time shifted subtitle blocks.
- GUI Desktop Dashboard: Build a drag-and-drop desktop application interface for batch video translation.
- Multi-Speaker Diarization Tagging: Identify speaker tags (
[Speaker 1]) and maintain distinct translation styles per speaker. - Real-Time Live Video Overlay: Translate live video streams in real-time with zero-latency sub-second subtitle rendering.
tencent-hymt2 · hy-mt2-1.8b · offline-ai-translation · ollama-gguf · srt-subtitle-translator · angelslim-stq · local-machine-translation · wmt26-translation · low-vram-ai · python-srt-parser