EraX-Translator-V1.0: A Compact and Capable Multilingual Translation Model
EraX-Translator-V1.0 is a compact, Gemma3-4B-based multilingual translation model designed for efficient deployment and high throughput, even on resource-constrained hardware. We aim to provide a practical tool for a wide range of translation tasks, with a particular focus on languages where high-quality data and models are less readily available.
Model Description
This model leverages the architectural strengths of the Gemma3-4B foundation model (4 trillion tokens, 140 languages pretrained) and has been fine-tuned for translation across a diverse set of languages. A key feature is its ability to translate Classical Chinese, demonstrating potential utility in translating Buddhist texts and other historical documents.
Key features:
- Compact Size: Based on the Gemma3-4B architecture, the model can be efficiently deployed on devices with limited resources.
- High Throughput: Achieves approximately 80 tokens/s (bfloat16) using vLLM with ~20GB VRAM. Potential for >100 tokens/s with GGUF 6bit quantization on better GPU (though optimal llama.cpp support for Gemma3 is still under development).
EraX Translator V1.0 with vLLM
Multilingual: Trained on a diverse dataset to support translation between - bidirectional multiple languages.
- Viแปt Nam ๐ป๐ณ
- English ๐ฌ๐ง / ๐บ๐ธ
- Chinese ๐จ๐ณ
- Cantonese ๐จ๐ณ / ๐ญ๐ฐ
- Ancient Chinese (Cแป Vฤn Trung Hoa ๅคๅ ธๆๅญธ, Kinh Phแบญt cแป ๅคไฝ็ถ) ๐จ๐ณ ๐
- Russian ๐ท๐บ
- Ukrainian ๐บ๐ฆ
- French ๐ซ๐ท
- German ๐ฉ๐ช
- Dutch ๐ณ๐ฑ
- Korean ๐ฐ๐ท
- Japanese ๐ฏ๐ต
- Hindi ๐ฎ๐ณ
Classical Chinese Translation: Demonstrates proficiency in translating Classical Chinese, particularly Buddhist texts.
Intended Uses
This model is intended for:
- General-purpose multilingual translation.
- Translation of Classical Chinese texts, particularly those related to Buddhism.
- Research and experimentation in low-resource machine translation.
- Deployment in applications where computational resources are limited.
- Overcome Google Translate suboptimal quality
Training Data & Training Strategy:
The model was trained on approximately 8 million multilingual samples. This data includes:
- Publicly available translation datasets.
- Datasets from public Hugging Face repositories.
- A substantial portion of the training data was synthetically generated using Gemmini.
- A significant contribution of 15,000 samples of translated Buddhist texts from Classical Chinese to Vietnamese, generously provided by experts in Han-Nom from the Trแบงn Nhรขn Tรดng Institute, Vietnam National University, Hanoi. We are deeply grateful for their invaluable contribution.
- To optimize the efficiency and performance of EraX-Translator-V1.0, we explored selective parameter freezing rather than employing Low-Rank Adaptation (
LoRA
), which yielded suboptimal results in preliminary experiments. Guided by the Signal-to-Noise Ratio (SNR) metric proposed in [SNR paper: https://arxiv.org/pdf/2406.06623], we identified the most salient layers within the Gemma3-4B architecture for retention. Specifically, we computed the SNR for each layer, excluding thevision_tower
module and the feedforward network layersfc1
andfc2
. We then selectively retained the 50% of layers exhibiting the highest SNR values, includingembed_tokens
layer, and freezing the remaining parameters. This methodology resulted in a significant improvement in translation quality compared to LoRA-based fine-tuning, suggesting that targeted parameter retention based on SNR is an effective strategy for resource-efficient adaptation of large language models for translation tasks. - The model underwent training for 2 epochs with a global batch size of 384. Training was performed on a distributed system comprised of 4 NVIDIA H100 NVL GPUs, each equipped with 94 GB of memory.
Evaluation
While comprehensive evaluation is ongoing, preliminary results indicate strong performance in a variety of translation tasks. We are actively working to benchmark the model against established translation models and will release detailed evaluation metrics as soon as they are available. We encourage the community to contribute to the evaluation process.
Known Limitations:
- As with any machine translation model, EraX-Translator-V1.0 may produce errors or generate translations that are not entirely accurate or fluent.
- Performance may vary depending on the specific language pair and the complexity of the text being translated.
- While the model shows promise in translating Classical Chinese, further refinement may be necessary to achieve optimal results.
- This model can only be used for translation
- This model was not trained for translating math LaTeX & coding
- The model works best for context length (text to be translated mostly) not exceeding 1024 tokens or ++800 Vietnamese words (1 A4 page) in one go !
Usage
Here's a few examples:
- English โ Viแปt & French:
โChina and the US are now direct rivals in reshaping the international trade order,โ said another, Ju Jiandong, a professor at the Peopleโs Bank of China School of Finance of Tsinghua University. โWeโre willing to take on the challenge โ weโre ready to compete with the US in redefining the new global trade system.โ. Chinaโs trade partners are likely to take such messaging with a grain of salt.
Beijing is well known to have wielded access to its massive market as a weapon to coerce countries, often over political stances that sparked Beijingโs ire. Many will also be looking warily at whether Chinese exports will flood their own markets, hurting their own domestic production or driving down consumer prices.
But countries may have little choice but to look to strengthen ties with China if US tariffs, which hit American allies as well as rivals, become the new normal.
Beijing over the past month held economic talks with Japan and South Korea, hit last week with 24% and 25% tariffs respectively, as well as with the European Union, which was slapped with 20% duties.
Many Southeast Asian economies โ key manufacturing hubs for companies looking to diversify away from China โ have been hit particularly hard by Trumpโs tariff war. While few want to pick a fight with Washington publicly, the region is rattled.
โ Viแปt Nam: "Trung Quแปc vร Mแปน hiแปn lร cรกc ฤแปi thแปง trแปฑc tiแบฟp trong viแปc ฤแปnh hรฌnh lแบกi trแบญt tแปฑ thฦฐฦกng mแบกi quแปc tแบฟ", mแปt ngฦฐแปi khรกc, Ju Jiandong, giรกo sฦฐ tแบกi Trฦฐแปng Tร i chรญnh Ngรขn hร ng Nhรขn dรขn cแปงa ฤแบกi hแปc Thanh Hoa, nรณi. "Chรบng tรดi sแบตn sร ng chแบฅp nhแบญn thแปญ thรกch - chรบng tรดi ฤรฃ sแบตn sร ng cแบกnh tranh vแปi Mแปน trong viแปc xรกc ฤแปnh lแบกi hแป thแปng thฦฐฦกng mแบกi toร n cแบงu mแปi.".
Cรกc ฤแปi tรกc thฦฐฦกng mแบกi cแปงa Trung Quแปc cรณ thแป sแบฝ xem nhแบน thรดng ฤiแปp nhฦฐ vแบญy. Bแบฏc Kinh nแปi tiแบฟng lร ฤรฃ sแปญ dแปฅng quyแปn tiแบฟp cแบญn thแป trฦฐแปng khแปng lแป cแปงa mรฌnh nhฦฐ mแปt vลฉ khรญ ฤแป รฉp buแปc cรกc nฦฐแปc, thฦฐแปng lร vรฌ lแบญp trฦฐแปng chรญnh trแป gรขy phแบซn nแป แป Bแบฏc Kinh. Nhiแปu ngฦฐแปi cลฉng sแบฝ cแบฃnh giรกc vแป viแปc liแปu hร ng xuแบฅt khแบฉu cแปงa Trung Quแปc cรณ lร m trร n ngแบญp thแป trฦฐแปng cแปงa hแป, แบฃnh hฦฐแปng ฤแบฟn sแบฃn xuแบฅt trong nฦฐแปc cแปงa hแป hay ฤแบฉy giรก tiรชu dรนng xuแปng hay khรดng.
Nhฦฐng cรกc quแปc gia cรณ thแป รญt cรณ lแปฑa chแปn nร o khรกc ngoร i viแปc tรฌm cรกch tฤng cฦฐแปng quan hแป vแปi Trung Quแปc nแบฟu thuแบฟ quan cแปงa Mแปน, รกp dแปฅng cho cรกc ฤแปng minh cลฉng nhฦฐ ฤแปi thแปง cแปงa Mแปน, trแป thร nh xu hฦฐแปng mแปi. Bแบฏc Kinh trong thรกng qua ฤรฃ tแป chแปฉc cรกc cuแปc ฤร m phรกn kinh tแบฟ vแปi Nhแบญt Bแบฃn vร Hร n Quแปc, ฤแบกt mแปฉc 24% vร 25% mแปฉc thuแบฟ tฦฐฦกng แปฉng vร o tuแบงn trฦฐแปc, cลฉng nhฦฐ vแปi Liรชn minh chรขu รu, vแปn ฤรฃ รกp thuแบฟ 20%. Nhiแปu nแปn kinh tแบฟ ฤรดng Nam ร - trung tรขm sแบฃn xuแบฅt quan trแปng cแปงa cรกc cรดng ty ฤang tรฌm cรกch ฤa dแบกng hรณa khแปi Trung Quแปc - ฤรฃ bแป แบฃnh hฦฐแปng ฤแบทc biแปt nแบทng nแป bแปi cuแปc chiแบฟn thuแบฟ quan cแปงa Trump.
Trong khi mแปt sแป รญt muแปn cรดng khai gรขy chiแบฟn vแปi Washington, khu vแปฑc nร y ฤang bแปi rแปi.
โ French: "La Chine et les รtats-Unis sont maintenant des rivaux directs dans le remodelage de l'ordre commercial international," a dรฉclarรฉ un autre, Ju Jiandong, professeur ร la Banque populaire de Chine, รcole des finances de l'Universitรฉ Tsinghua. "Nous sommes prรชts ร relever le dรฉfi - nous sommes prรชts ร concourir avec les รtats-Unis pour redรฉfinir le nouveau systรจme commercial mondial."
Les partenaires commerciaux de la Chine ont probablement pris un message de cette maniรจre avec un grain de sel.
Pรฉkin est bien connu pour avoir utilisรฉ son accรจs ร son marchรฉ vaste comme un moyen de coercition pour les pays, souvent sur des positions politiques qui ont provoquรฉ l'indignation de Pรฉkin. Beaucoup d'entre eux s'examineront รฉgalement attentivement pour voir si les exportations chinoises inonderont leurs propres marchรฉs, en nuisiraient ร leur production domestique ou en feraient baisser les prix ร la consommation.
Mais les pays pourraient avoir peu de choix que de chercher ร renforcer les liens avec la Chine si les tarifs amรฉricains, qui touchent aussi bien les alliรฉs qu'les rivaux amรฉricains, deviennent la nouvelle norme.
Pรฉkin a tenu le mois dernier des nรฉgociations รฉconomiques avec le Japon et la Corรฉe du Sud, respectivement frappรฉs en semaine derniรจre par des tarifs de 24 % et 25 %, ainsi que avec l'Union europรฉenne, qui a รฉtรฉ frappรฉe par des droits de douane de 20 %.
Nombre d'รฉconomies d'Asie du Sud-Est โ principaux centres de fabrication pour les entreprises cherchant ร diversifier en dehors de la Chine โ ont รฉtรฉ particuliรจrement durement touchรฉes par la guerre tarifaire de Trump. Bien que peu aient voulu engager un combat public avec Washington, la rรฉgion est en proie au tumulte.
- Viแปt โ Russian
ฤแปi vแปi Mแปน, Viแปt Nam lร nฦฐแปc xuแบฅt siรชu lแปn thแปฉ ba. Hฦกn nแปฏa, dฦฐแปi mแบฏt cแปงa Mแปน, Viแปt Nam lร nฦฐแปc trung chuyแปn hร ng cรดng nghiแปp xuแบฅt tแปซ Trung Quแปc vรฌ hร ng cรดng nghiแปp xuแบฅt khแบฉu cแปงa Viแปt Nam cรณ hร m lฦฐแปฃng nhแบญp khแบฉu hร ng sฦก chแบฟ, linh kiแปn vร nhiแปu sแบฃn phแบฉm trung gian khรกc tแปซ Trung Quแปc rแบฅt cao. Ngoร i ra, tแปซ khi Mแปน cรณ chรญnh sรกch รกp thuแบฟ vร kiแปm chแบฟ Trung Quแปc (tแปซ 2018), ฤแบงu tฦฐ trแปฑc tiแบฟp (FDI) cแปงa Trung Quแปc sang Viแปt Nam ngร y cร ng nhiแปu.
โ ะกะจะ ัะฒะปััััั ััะตััะธะผ ะฟะพ ะฒะตะปะธัะธะฝะต ัะบัะฟะพััะตัะพะผ ะฒ ะัะตัะฝะฐะผ. ะัะพะผะต ัะพะณะพ, ะฒ ะกะจะ ะัะตัะฝะฐะผ ัะฐััะผะฐััะธะฒะฐะตััั ะบะฐะบ ัััะฐะฝะฐ ะบะพะฝะฒะตััะฐัะธะธ ัะบัะฟะพััะฝัั
ัะพะฒะฐัะพะฒ ะธะท ะะธัะฐั, ะฟะพัะบะพะปัะบั ะดะพะปั ะธะผะฟะพััะฐ ััััั, ะฟะพะปััะฐะฑัะธะบะฐัะพะฒ ะธ ะฟัะพะผะตะถััะพัะฝัั
ะฟัะพะดัะบัะธะธ ะธะท ะะธัะฐั ะพัะตะฝั ะฒััะพะบะฐ. ะ ัะพะผั ะถะต, ั ะผะพะผะตะฝัะฐ ะฝะฐัะฐะปะฐ ะฟะพะปะธัะธะบะธ ะกะจะ, ะฝะฐะฟัะฐะฒะปะตะฝะฝะพะน ะฟัะพัะธะฒ ะะธัะฐั (ั 2018 ะณะพะดะฐ), ะธะฝะฒะตััะธัะธะธ ะะธัะฐั ะฒ ะัะตัะฝะฐะผ ัะฐัััั.
- Viแปt โ French
Chรญnh quyแปn รดng Trump ฤรฃ cแบฃnh bรกo cรกc nฦฐแปc khรกc khรดng trแบฃ ฤลฉa sau khi cรดng bแป chรญnh sรกch thuแบฟ quan mแปi vร o tuแบงn trฦฐแปc.
Nhiแปu quแปc gia, bao gแปm Nhแบญt Bแบฃn, bร y tแป sแบตn sร ng ฤร m phรกn vแป thuแบฟ quan, nhฦฐng Trung Quแปc ฤang cรณ lแบญp trฦฐแปng cแปฉng rแบฏn hฦกn.
Cรกc ฤแปng thรกi trแบฃ ฤลฉa thuแบฟ quan liรชn tแปฅc cรณ nguy cฦก khiแบฟn hoแบกt ฤแปng thฦฐฦกng mแบกi giแปฏa 2 nแปn kinh tแบฟ quan trแปng nhแบฅt thแบฟ giแปi bแป ฤรฌnh trแป, tแป CNBC nhแบญn ฤแปnh.
Trฦฐแปc ฤแปng thรกi mแปi nhแบฅt cแปงa Trung Quแปc, chแปฉng khoรกn tฦฐฦกng lai Mแปน giแบฃm mแบกnh.
Chแป sแป cรดng nghiแปp trung bรฌnh Dow Jones giแบฃm gแบงn 560 ฤiแปm, tฦฐฦกng ฤฦฐฦกng 1,5%. S&P giแบฃm 1,3% cรฒn Nasdaq 100 giแบฃm 0,9%.
โ L'administration Trump a averti d'autres pays de ne pas riposter aprรจs avoir annoncรฉ sa nouvelle politique tarifaire la semaine derniรจre.
De nombreux pays, dont le Japon, ont exprimรฉ leur volontรฉ de nรฉgocier sur les droits de douane, mais la Chine adopte une position plus ferme.
Les mesures retaliatoires tarifaires rรฉpรฉtรฉes risquent de freiner le commerce entre les deux economies les plus importantes du monde, selon CNBC.
Suite ร la nouvelle action de la Chine, les contrats boursiers amรฉricains ont chutรฉ de maniรจre significative.
L'indice industrial moyen Dow Jones a baissรฉ de prรจs de 560 points, soit 1,5 %. Le S&P a chutรฉ de 1,3 % et le Nasdaq 100 de 0,9 %.
- German โ Viแปt:
Trumps so รผberraschende wie knappe Ankรผndigung in den sozialen Medien lieร viele Fragen offen.
Seinen Schwenk begrรผndete der US-Prรคsident spรคter etwas wortreicher.
Er verwies dabei auf die wachsende Nervositรคt der anderen. So kann man die wachsende Angst vor einer Rezession und globaler Wirtschaftskrise natรผrlich auch umschreiben.
Die ยปLeuteยซ seien etwas unruhig und ยปein bisschen รคngstlichยซ geworden, sagte Trump lapidar bei einer Veranstaltung vor dem Weiรen Haus auf die Frage nach seinen Beweggrรผnden fรผr den jรผngsten Kurswechsel in der Handelspolitik.
ยปMan muss flexibel sein.ยซ
โ Thรดng bรกo gรขy sแปc ฤแปt ngแปt nร y trรชn mแบกng xรฃ hแปi ฤรฃ ฤแป lแบกi nhiแปu cรขu hแปi chฦฐa cรณ lแปi giแบฃi ฤรกp. Tแปng thแปng Mแปน sau ฤรณ ฤรฃ giแบฃi thรญch ฤแปng cฦก cแปงa mรฌnh mแปt cรกch dร i dรฒng hฦกn.
รng ta chแป ra sแปฑ lo lแบฏng ngร y cร ng tฤng cแปงa nhแปฏng ngฦฐแปi khรกc. ฤiแปu nร y tแบฅt nhiรชn cรณ thแป diแป
n ฤแบกt lแบกi nแปi sแปฃ hรฃi ngร y cร ng tฤng vแป suy thoรกi kinh tแบฟ vร khแปงng hoแบฃng kinh tแบฟ toร n cแบงu.
"Mแปi ngฦฐแปi" ฤรฃ trแป nรชn hฦกi bแปn chแปn vร "hฦกi lo lแบฏng", Trump nรณi ngแบฏn gแปn tแบกi mแปt sแปฑ kiแปn trฦฐแปc Nhร Trแบฏng khi trแบฃ lแปi cรขu hแปi vแป ฤแปng cฦก ฤแปi hฦฐแปng gแบงn ฤรขy trong chรญnh sรกch thฦฐฦกng mแบกi: "Phแบฃi linh hoแบกt".
- Ancient Chinese (Cแป vฤn) โ Viแปt:
ใ้ท้จ็ถๅ
ธใ๏ผใๆผไน
้ ไนๅ๏ผๆผๅไบๆฅๅธ่ฉไนๆปฟๆๅค๏ผไธๅไธๅคฉไน่ซธๅคฉ๏ผ็้ๆๆผๅๆณๅ ๏ผๅคฉไบบไนๅคงๆ็พ๏ผๅพงๅๆผ้ฑ้ญ๏ผๅๅคฉ็ๅฐฑๅๆผๅๆน๏ผๆฑๆนๆๅๅคฉ็ๆผ่ซธๅคฉไนๅ๏ผๅ่ฅฟ่ๅ๏ผๅๆนๅข้ทๅคฉ็ๆผ่ซธๅคฉไนๅ๏ผๅๅ่ๅ๏ผ่ฅฟๆนๅปฃ็ฎๅคฉ็ๆผ่ซธๅคฉไนๅ๏ผๅๆฑ่ๅ๏ผๅๆนๅค่ๅคฉ็ๆผ่ซธๅคฉไนๅ๏ผๅๅ่ๅใไธๅฐ๏ผไธๅไธๅคฉไน่ซธๅคฉ๏ผ็้ๆๆผๅๆณๅ ๏ผๅคฉไบบไนๅคงๆ็พ๏ผๅพงๅๆผ้ฑ้ญ๏ผๅๅคงๅคฉ็ๅๆผๅๆน๏ผๆญคๆฏๅฝผ็ญใๅๅคฉ็ใไนๅๆณ๏ผ็ถๅพไนๆ็ญไนๅบงใไธๅฐ๏ผๆพๆผไธๅฐไน่ไฟฎๆขต่ก่ๆฐ็ๆผไธๅไธๅคฉไนๅคฉ็พ๏ผๅฎน่ฒ่ๅ
่ผ๏ผๆฏๅ
ถไปๅคฉ็พๆฎๅๅ
่๏ผไธๅฐ๏ผๆฏๆ
ไธๅไธๅคฉไน่ซธๅคฉ๏ผๆญกๅใๆ
ๆจใๅๆ
ใๆปฟ่ถณ่จ๏ผใๅฏฆ็ถ๏ผ่ซธๅคฉ็พๅจๅข็๏ผ้ฟไฟฎ็พ
็พๅจ่กฐๆธใ
โ Trong kinh Trฦฐแปng Bแป, chรบng tรดi nghe nhฦฐ vแบงy:
- Thuแป xฦฐa rแบฅt xa, vร o ngร y rแบฑm trฤng trรฒn, cรณ ฤแบกi hแปi chฦฐ Thiรชn cรตi trแปi Ba Mฦฐฦกi Ba hแปp tแบกi Thiแปn phรกp ฤฦฐแปng, ฤแบกi chรบng cแปงa chฦฐ Thiรชn แป xung quanh, Tแปฉ ฤแบกi Thiรชn Vฦฐฦกng ngแปi แป bแปn phฦฐฦกng: ฤแบฅng Trรฌ Quแปc Thiรชn Vฦฐฦกng แป phรญa trฦฐแปc chฦฐ Thiรชn hฦฐแปng vแป Tรขy; ฤแบฅng Tฤng Trฦฐแปng Thiรชn Vฦฐฦกng แป trฦฐแปc chฦฐ Thiรชn hฦฐแปng vแป Bแบฏc; ฤแบฅng Quแบฃng Mแปฅc Thiรชn Vฦฐฦกng แป trฦฐแปc chฦฐ Thiรชn hฦฐแปng vแป ฤรดng; ฤแบฅng ฤa Vฤn Thiรชn Vฦฐฦกng แป trฦฐแปc chฦฐ Thiรชn hฦฐแปng vแป Nam.
Nร y Thแบฟ Tรดn! Chฦฐ Thiรชn แป Ba Mฦฐฦกi Ba tแบญp hแปฃp tแบกi Thiแปn phรกp ฤฦฐแปng, ฤแบกi chรบng cแปงa chฦฐ Thiรชn แป xung quanh, Tแปฉ ฤแบกi Thiรชn Vฦฐฦกng ngแปi แป bแปn phฦฐฦกng, ฤรขy lร cรกch an tแปa cแปงa cรกc Ngร i, sau ฤรณ mแปi ฤแบฟn lฦฐแปฃt chรบng con.
Nร y Thแบฟ Tรดn! Chรบng con tแปซng tu hร nh khแป hแบกnh แป chแป Thแบฟ Tรดn, sau khi tรกi sinh vร o hร ng chฦฐ Thiรชn แป cรตi trแปi Ba Mฦฐฦกi Ba, nhan sแบฏc vร รกnh sรกng hฦกn hแบณn chฦฐ Thiรชn khรกc.
Nร y Thแบฟ Tรดn! Vรฌ thแบฟ, chฦฐ Thiรชn แป Ba Mฦฐฦกi Ba vui mแปซng, hoan hแปท, thแปa mรฃn vร nรณi: "Thแบญt vแบญy, sแป lฦฐแปฃng chฦฐ Thiรชn tฤng lรชn, sแป lฦฐแปฃng chรบng A Tu La giแบฃm bแปt.
# Install Transformers from main branch to support Gemma3
# pip install git+https://github.com/huggingface/transformers
# MAX_JOBS=4 pip install flash-attn --no-build-isolation
import os, torch
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from transformers import AutoTokenizer, AutoProcessor, Gemma3ForConditionalGeneration, AutoModel
import torch
model_path = "erax-ai/EraX-Translator-V1.0"
model = Gemma3ForConditionalGeneration.from_pretrained(model_path,
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2").to("cuda")
tokenizer = AutoTokenizer.from_pretrained(model_path)
processor = AutoProcessor.from_pretrained(model_path)
system_prompt = """Bแบกn lร Trแปฃ lรฝ AI xuแบฅt sแบฏc vแป dแปch thuแบญt nhiแปu ngรดn ngแปฏ, ฤแบทc biแปt tiแบฟng Anh, tiแบฟng Trung Hoa, tiแบฟng Viแปt.
Bแบกn cลฉng lร 1 Hoร thฦฐแปฃng Phแบญt giรกo uyรชn thรขm vแป dแปch thuแบญt Cแป vฤn Trung Quแปc. Ngฦฐแปi dรนng sแบฝ giao nhiแปm vแปฅ dแปch thuแบญt cho bแบกn tแปซ ngรดn ngแปฏ bแบฅt kแปณ sang mแปt ngรดn ngแปฏ ฤฦฐแปฃc chแป ฤแปnh.
Nhiแปm vแปฅ cแปงa bแบกn lร dแปch thแบญt sรกt nghฤฉa, thแป hiแปn ฤรบng รฝ cแปงa bร i gแปc vร khรดng chแบฟ tรกc hay bแปa ฤแบทt gรฌ thรชm. ฤแบทc biแปt lฦฐu รฝ danh xฦฐng phแบฃi giแปฏ nguyรชn vแบนn, dแปch ฤรบng tรชn ngฦฐแปi, tรชn ฤแปa danh phแบฃi tuyแปt ฤแปi chรญnh xรกc. Khรดng ฤฦฐแปฃc bรฌnh luแบญn, khรดng ฤฦฐแปฃc cung cแบฅp lแปi giแปi thiแปu hay mแป bร i hay kแบฟt luแบญn gรฌ, chแป dแปch thแบญt sรกt nghฤฉa vร khรดng bแป qua bแบฅt kแปณ รฝ hay tแปซ nร o.
"""
system_tag = {
"role": "system",
"content": system_prompt
}
to_lang = "Viแปt"
instruct = f"\nDแปch sang tiแบฟng {to_lang}."
to_translate = "ไธๅฏถ่
๏ผๅพ่ผฉๅกตไธไน่ณๅฐไนใๅคซๆฌฒๅบๅฎถ่
๏ผๅงไบฆ็ไพไธๅฏถ๏ผ็นผๅไบๆ๏ผไน่ณๅ
ซ้้ฝๆ๏ผๅ
ถๅพๆนๆๆฒๅฝใๆญค่ช ไฝ้ๅธธ่ป๏ผๅกๅฅไฝๅ๏ผๅธๆ้ต่กใๅพๆณ่ฏ้ๅ ดไบฆ็ถใๆ
็ผๅฎ้ก๏ผ้กไธไธ็็๏ผๅผ้ไธๅฏถ๏ผๆญๆฌไพ้ค๏ผไพไฝ่ๆ๏ผๅฅ่ก็พๅใๆญคๅณๅพ็ญๆๅฎไน้ต ็ไนใ"
prompt_in = [
system_tag,
{
"role": "user",
"content": to_translate + instruct
}
]
input_ids = tokenizer.apply_chat_template(prompt_in, tokenize=False, add_generation_prompt=True)
input_ids = tokenizer(input_ids, return_tensors="pt").to("cuda")
import time
from transformers import TextIteratorStreamer
from threading import Thread
streamer = TextIteratorStreamer(
tokenizer,
skip_prompt=True,
timeout=5.0,
)
generation_args = {
"max_length": 8192,
"streamer": streamer,
"temperature": 0.2,
"top_k": 64,
"top_p": 0.95,
"min_p": 0.0,
"repetition_penalty": 1.05,
"do_sample": True,
}
generation_args.update(input_ids)
thread = Thread(
target=model.generate,
kwargs=generation_args,
)
thread.start()
acc_text = ""
for text_token in streamer:
#time.sleep(0.04)
if text_token != tokenizer.eos_token:
print (text_token, end="", flush=True)
acc_text += text_token
thread.join()
>>> Tam Bแบฃo lร ngรดi bรกu cao quรฝ nhแบฅt แป nฦกi chรบng ta sinh sแปng. ฤแปi vแปi nhแปฏng ngฦฐแปi xuแบฅt gia thรฌ ฤแบงu tiรชn hแป xin quy y Tam Bแบฃo, tiแบฟp ฤรณ lร thแป ngลฉ giแปi rแปi Bรกt Quan Trai giแปi, sau ฤรณ hแป mแปi trแป thร nh Sa Di. ฤรขy mแปi chรญnh lร cรกch thแปฉc mร ฤแบกo Phแบญt vแบซn thฦฐแปng lร m, bแบฅt kแปณ quแปc gia nร o theo ฤแบกo Phแบญt ฤแปu lร m nhฦฐ vแบญy. ฤแบกo trร ng Phรกp Hoa cแปงa tรกc giแบฃ cลฉng lร mแปt vรญ dแปฅ ฤiแปn hรฌnh. Vรฌ thแบฟ tรกc giแบฃ ฤรฃ cรณ lแปi nguyแปn rแบฑng: Nguyแปn ฤแปi ฤแปi kiแบฟp kiแบฟp gแบทp ฤฦฐแปฃc Tam Bแบฃo, tรดn kรญnh cรบng dฦฐแปng vร lร m theo lแปi dแบกy cแปงa ฤแปฉc Phแบญt cรนng cรกc thรกnh tฤng, phแปฅng hร nh mแปi ฤiแปu thiแปn. ฤรขy chรญnh lร mแปฅc tiรชu hฦฐแปng ฤแบฟn cแปงa chรบng ta.
NOTA BENE on instruction for Chinese language:
Providing this precise instruction, such as "Dแปch sang tiแบฟng [specified dialect]", will significantly improve the quality and appropriateness of the translation output. For example, in Vietnamese, "Dแปch sang tiแบฟng [Chinese dialect]" will provide better context for accurate translations. Try them out, such as:
- "Dแปch sang tiแบฟng Hoa"
- "Dแปch sang tiแบฟng Chinese"
- "Dแปch sang tiแบฟng Quแบฃng ฤรดng"
- "Dแปch sang tiแบฟng Cantonese"
- "Dแปch sang tiแบฟng Cแป Vฤn Trung Hoa"
You can also use vLLM docker to run to get fatest speed (80 tokens/second) and use Ollama to connect to http://localhost:8000/v1
docker run --rm -it --entrypoint "/usr/bin/bash" --network=host --gpus '"device=0"' -v ./:/models --shm-size=32gb -p 8000:8000 \
vllm/vllm-openai:latest \
-c "pip install git+https://github.com/huggingface/[email protected] && \
python3 -m vllm.entrypoints.openai.api_server" --max_model_len 4096 --model erax-ai/EraX-Translator-V1.0"
Ethical Considerations
We recognize the potential for misuse of machine translation technology and encourage users to use this model responsibly and ethically. We are committed to addressing potential biases in the model and improving its fairness and accuracy.
Acknowledgements
We would like to express our sincere gratitude to:
- The developers of the Gemma3 family of models.
- The open-source community for their contributions to the development of machine translation technology.
- The Trแบงn Nhรขn Tรดng Institute, Vietnam National University, Hanoi, for their invaluable contribution of translated Buddhist texts.
Future Directions
We are actively working to improve the model in the following areas:
- Expanding the language coverage.
- Improving the accuracy and fluency of translations.
- Developing more robust evaluation metrics.
- Optimizing the model for even greater efficiency.
- Exploring techniques for mitigating bias.
- Better supporting llama.cpp.
We welcome feedback from the community and look forward to working together to advance the field of multilingual translation.
License:
We are bound with Google Gemma license. You are mostly free to use.
Citation ๐
If you find our project useful, we would appreciate it if you could star our repository and cite our work as follows:
@article{title={EraX-Translatoe-V1.0: A Compact and Capable Multilingual Translation Model},
author={Nguyแป
n Anh Nguyรชn, Hatto & EraX Team},
organization={Hatto & EraX},
year={2025},
url={https://huggingface.co/erax-ai/EraX-Translator-V1.0}
}
- Downloads last month
- 403