Add en-roa and roa-en Opus-MT translation models - #752
Merged
Conversation
Replace the broken en-pt wrapper (pointed at the nonexistent Helsinki-NLP/opus-mt-en-pt checkpoint) with two working models: - opus-mt-roa-en: Romance to English (covers pt->en), drop-in. - opus-mt-en-roa: English to Romance, multi-target with a target_language selector; prepends the required >>id<< language token to each source sentence. All multi-target handling is kept in the model file so the shared OpusMtTransformerMixin stays single-pair.
cristian-tamblay
approved these changes
Jul 7, 2026
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
Removes the broken English to Portuguese translation model, which pointed at the nonexistent
Helsinki-NLP/opus-mt-en-ptcheckpoint (Hugging Face returns 401 for it, so any training/prediction crashed on download). Replaces it with two verified working Opus-MT models that cover Portuguese in both directions, plus other Romance languages.Type of Change
Changes (by file)
DashAI/back/models/hugging_face/opus_mt_en_pt_transformer.py: deleted. ReferencedHelsinki-NLP/opus-mt-en-pt, which does not exist on Hugging Face.DashAI/back/models/hugging_face/opus_mt_roa_en_transformer.py: new. Romance to English wrapper (Helsinki-NLP/opus-mt-roa-en, ~74M). Covers Portuguese to English; drop in, reuses the shared training schema, no language token required.DashAI/back/models/hugging_face/opus_mt_en_roa_transformer.py: new. English to Romance wrapper (Helsinki-NLP/opus-mt-en-roa, ~74M). Multi-target with atarget_languageselector (Portuguese, Spanish, French, Italian, Romanian, Catalan, Galician). Prepends the checkpoint-required>>id<<language token to each source sentence, and persists/restores the chosen language across save/load. All multitarget logic is kept inside this file so the sharedOpusMtTransformerMixinstays single pair.DashAI/back/initial_components.py: unregisteredOpusMtEnPtTransformer; registeredOpusMtEnRoaTransformerandOpusMtRoaEnTransformer.Testing
opus-mt-en-roaend to end to confirm the save/load roundtrip keeps the language prefix.Notes
en-roamodel requires atarget_language, but the sharedmixin.load()reconstructs the model without it. Handled by supplying a placeholder during construction and restoring the real value from disk in the model's overriddenload(), keeping the mixin untouched.roa-ensince the target is always English; source text (e.g. Portuguese) is fed as is.