--- language: - zh - ru tags: - marian - opus-mt - translation - mnn - android - on-device license: apache-2.0 library_name: transformers pipeline_tag: translation --- # OPUS-MT zh→ru (Custom Trained) This is a custom-trained Marian-based translation model for zh→ru. It was fine-tuned from [`Helsinki-NLP/opus-mt-zh-en`](https://huggingface.co/Helsinki-NLP/opus-mt-zh-en) and converted to MNN format via the [mnn-opus-mt-toolkit](https://github.com/HoSStiA/mnn-opus-mt-toolkit). ## Model Details | Parameter | Value | |-----------|-------| | Architecture | MarianMT (encoder-decoder Transformer) | | Source language | zh | | Target language | ru | | Base model | `Helsinki-NLP/opus-mt-zh-en` | | BLEU score | 24.55 | | chrF score | 41.83 | | Training pairs | 450,000 | | Training epochs | 25 | ## Usage ### With Hugging Face Transformers ```python from transformers import AutoModelForSeq2SeqLM, MarianTokenizer model = AutoModelForSeq2SeqLM.from_pretrained("Hosstia/opus-mt-zh-ru-opus-mp") tokenizer = MarianTokenizer.from_pretrained("Hosstia/opus-mt-zh-ru-opus-mp") text = "Your source text here" inputs = tokenizer(text, return_tensors="pt") outputs = model.generate(**inputs) translation = tokenizer.decode(outputs[0], skip_special_tokens=True) ``` ### With MNN (on-device Android) Convert to MNN format using the [mnn-opus-mt-toolkit](https://github.com/HoSStiA/mnn-opus-mt-toolkit): ```bash ./run_all.sh --hf-user --src zh --dst ru --format fp16 \ --model-repo Hosstia/opus-mt-zh-ru-opus-mp --tokenizer-repo Hosstia/opus-mt-zh-ru-opus-mp ``` ## License Apache License 2.0 (model weights); see the toolkit repository for details. ## Acknowledgments - [Helsinki-NLP](https://huggingface.co/Helsinki-NLP) for the original OPUS-MT models - [Marian NMT](https://github.com/marian-nmt/marian) for the training framework - [Alibaba MNN](https://github.com/alibaba/MNN) for the on-device inference engine - [Hugging Face](https://huggingface.co) for model hosting and the Transformers library