Hosstia commited on
Commit
9602b83
·
verified ·
1 Parent(s): 0b92f03

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - zh
4
+ - ru
5
+ tags:
6
+ - marian
7
+ - opus-mt
8
+ - translation
9
+ - mnn
10
+ - android
11
+ - on-device
12
+ license: apache-2.0
13
+ library_name: transformers
14
+ pipeline_tag: translation
15
+ ---
16
+
17
+ # OPUS-MT zh→ru (Custom Trained)
18
+
19
+ This is a custom-trained Marian-based translation model for zh→ru.
20
+ It was fine-tuned from [`Helsinki-NLP/opus-mt-zh-en`](https://huggingface.co/Helsinki-NLP/opus-mt-zh-en)
21
+ and converted to MNN format via the [mnn-opus-mt-toolkit](https://github.com/HoSStiA/mnn-opus-mt-toolkit).
22
+
23
+ ## Model Details
24
+
25
+ | Parameter | Value |
26
+ |-----------|-------|
27
+ | Architecture | MarianMT (encoder-decoder Transformer) |
28
+ | Source language | zh |
29
+ | Target language | ru |
30
+ | Base model | `Helsinki-NLP/opus-mt-zh-en` |
31
+ | BLEU score | 24.55 |
32
+ | chrF score | 41.83 |
33
+ | Training pairs | 450,000 |
34
+ | Training epochs | 25 |
35
+
36
+ ## Usage
37
+
38
+ ### With Hugging Face Transformers
39
+ ```python
40
+ from transformers import AutoModelForSeq2SeqLM, MarianTokenizer
41
+
42
+ model = AutoModelForSeq2SeqLM.from_pretrained("Hosstia/opus-mt-zh-ru-opus-mp")
43
+ tokenizer = MarianTokenizer.from_pretrained("Hosstia/opus-mt-zh-ru-opus-mp")
44
+
45
+ text = "Your source text here"
46
+ inputs = tokenizer(text, return_tensors="pt")
47
+ outputs = model.generate(**inputs)
48
+ translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
49
+ ```
50
+
51
+ ### With MNN (on-device Android)
52
+ Convert to MNN format using the [mnn-opus-mt-toolkit](https://github.com/HoSStiA/mnn-opus-mt-toolkit):
53
+ ```bash
54
+ ./run_all.sh --hf-user <username> --src zh --dst ru --format fp16 \
55
+ --model-repo Hosstia/opus-mt-zh-ru-opus-mp --tokenizer-repo Hosstia/opus-mt-zh-ru-opus-mp
56
+ ```
57
+
58
+ ## License
59
+
60
+ Apache License 2.0 (model weights); see the toolkit repository for details.
61
+
62
+ ## Acknowledgments
63
+
64
+ - [Helsinki-NLP](https://huggingface.co/Helsinki-NLP) for the original OPUS-MT models
65
+ - [Marian NMT](https://github.com/marian-nmt/marian) for the training framework
66
+ - [Alibaba MNN](https://github.com/alibaba/MNN) for the on-device inference engine
67
+ - [Hugging Face](https://huggingface.co) for model hosting and the Transformers library