feat(translators): add M2M100 HuggingFace translator (Nvidia CUDA / AMD ROCm)#1157
Open
zachelnet wants to merge 1 commit into
Open
feat(translators): add M2M100 HuggingFace translator (Nvidia CUDA / AMD ROCm)#1157zachelnet wants to merge 1 commit into
zachelnet wants to merge 1 commit into
Conversation
This was referenced Jul 3, 2026
f6998d5 to
c599b86
Compare
6b9ecc9 to
7d79718
Compare
Adds two new offline translator variants using HuggingFace transformers directly instead of ctranslate2, enabling AMD ROCm support. New translator keys: m2m100_hf — facebook/m2m100_418M m2m100_hf_big — facebook/m2m100_1.2B Changes: - manga_translator/translators/m2m100_hf.py (new) - manga_translator/config.py: add m2m100_hf / m2m100_hf_big to Translator enum - manga_translator/translators/__init__.py: register in OFFLINE_TRANSLATORS - README.md: add entries to translator reference table and JSON schema enum Implementation details: - Uses AutoModelForSeq2SeqLM + AutoTokenizer directly (no pipeline-per-sentence) - Model moved to device via .to(device) — works on Nvidia CUDA, AMD ROCm, CPU - Auto language detection via langdetect on the full batch - Falls back to '' on unrecoverable errors - _check_downloaded checks both model.safetensors and pytorch_model.bin Co-authored-by: GitHub Copilot <github-copilot[bot]@users.noreply.github.com>
7d79718 to
c289bf1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new offline translator variants that use the HuggingFace
transformerslibrary directly instead of
ctranslate2.m2m100_hfm2m100_hf_bigMotivation
The existing
m2m100andm2m100_bigtranslators depend onctranslate2, whichonly supports Nvidia CUDA. Users with AMD GPUs (ROCm) have no working M2M100
option. These new variants run on any PyTorch-supported device (Nvidia CUDA,
AMD ROCm, CPU).
Changes
manga_translator/translators/m2m100_hf.py— new translator usingAutoModelForSeq2SeqLM+AutoTokenizerdirectly (no pipeline-per-sentence)manga_translator/config.py— addm2m100_hf/m2m100_hf_bigtoTranslatorenummanga_translator/translators/__init__.py— registerm2m100_hf/m2m100_hf_bigin
OFFLINE_TRANSLATORSREADME.md— add entries to translator reference table and JSON schema enumNotes
langdetecton the full batch''on unrecoverable errors (no blockinginput())_check_downloadedchecks bothmodel.safetensorsandpytorch_model.binCo-authored-by: GitHub Copilot <github-copilot[bot]@users.noreply.github.com>