Translation
Transformers
Safetensors
Logudorese Sardinian
dst
marian
text2text-generation
opus-mt
mnn
android
on-device
Instructions to use Hosstia/opus-mt-zh-ru-32k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Hosstia/opus-mt-zh-ru-32k with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="Hosstia/opus-mt-zh-ru-32k")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Hosstia/opus-mt-zh-ru-32k") model = AutoModelForSeq2SeqLM.from_pretrained("Hosstia/opus-mt-zh-ru-32k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
OPUS-MT src→dst (Custom Trained)
This is a custom-trained Marian-based translation model for src→dst.
It was fine-tuned from Helsinki-NLP/opus-mt-zh-en
and converted to MNN format via the mnn-opus-mt-toolkit.
Model Details
| Parameter | Value |
|---|---|
| Architecture | MarianMT (encoder-decoder Transformer) |
| Source language | src |
| Target language | dst |
| Base model | Helsinki-NLP/opus-mt-zh-en |
Usage
With Hugging Face Transformers
from transformers import AutoModelForSeq2SeqLM, MarianTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("Hosstia/opus-mt-zh-ru-32k")
tokenizer = MarianTokenizer.from_pretrained("Hosstia/opus-mt-zh-ru-32k")
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:
./run_all.sh --hf-user <username> --src src --dst dst --format fp16 \
--model-repo Hosstia/opus-mt-zh-ru-32k --tokenizer-repo Hosstia/opus-mt-zh-ru-32k
License
Apache License 2.0 (model weights); see the toolkit repository for details.
Acknowledgments
- Helsinki-NLP for the original OPUS-MT models
- Marian NMT for the training framework
- Alibaba MNN for the on-device inference engine
- Hugging Face for model hosting and the Transformers library
- Downloads last month
- 43