Nightmare
commited on
Commit
•
228263d
1
Parent(s):
eaec037
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This is a finetuned version of Facebook/M2M100.
|
2 |
+
It has been trained on a parallel corpus on several Chinese video games translations. All of them are from human/fan translations.
|
3 |
+
|
4 |
+
Sample generation script :
|
5 |
+
|
6 |
+
```from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
7 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(r"path\to\checkpoint")
|
8 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(r"path\to\checkpoint")
|
9 |
+
tokenizer.src_lang = "zh"
|
10 |
+
tokenizer.tgt_lang = "en"
|
11 |
+
test_string = "地阶上品遁术,施展后便可立于所持之剑上,以极快的速度自由飞行。"
|
12 |
+
|
13 |
+
inputs = tokenizer(test_string, return_tensors="pt")
|
14 |
+
translated_tokens = model.generate(**inputs, num_beams=10, do_sample=True)
|
15 |
+
translation = tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
|
16 |
+
|
17 |
+
print("CH : ", test_string , " // EN : ", translation)```
|
18 |
+
|