Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- multilingual
|
4 |
+
- ar
|
5 |
+
- cs
|
6 |
+
- de
|
7 |
+
- en
|
8 |
+
- es
|
9 |
+
- et
|
10 |
+
- fi
|
11 |
+
- fr
|
12 |
+
- gu
|
13 |
+
- hi
|
14 |
+
- it
|
15 |
+
- ja
|
16 |
+
- kk
|
17 |
+
- ko
|
18 |
+
- lt
|
19 |
+
- lv
|
20 |
+
- my
|
21 |
+
- ne
|
22 |
+
- nl
|
23 |
+
- ro
|
24 |
+
- ru
|
25 |
+
- si
|
26 |
+
- tr
|
27 |
+
- vi
|
28 |
+
- zh
|
29 |
+
- af
|
30 |
+
- az
|
31 |
+
- bn
|
32 |
+
- fa
|
33 |
+
- he
|
34 |
+
- hr
|
35 |
+
- id
|
36 |
+
- ka
|
37 |
+
- km
|
38 |
+
- mk
|
39 |
+
- ml
|
40 |
+
- mn
|
41 |
+
- mr
|
42 |
+
- pl
|
43 |
+
- ps
|
44 |
+
- pt
|
45 |
+
- sv
|
46 |
+
- sw
|
47 |
+
- ta
|
48 |
+
- te
|
49 |
+
- th
|
50 |
+
- tl
|
51 |
+
- uk
|
52 |
+
- ur
|
53 |
+
- xh
|
54 |
+
- gl
|
55 |
+
- sl
|
56 |
+
license: mit
|
57 |
+
tags:
|
58 |
+
- mbart-50
|
59 |
+
---
|
60 |
+
|
61 |
+
# mBART-50
|
62 |
+
|
63 |
+
Knight-errant is a test style transfer model for knight-errant style.
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
```python
|
69 |
+
|
70 |
+
#inference
|
71 |
+
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
72 |
+
|
73 |
+
model = MBartForConditionalGeneration.from_pretrained("Anonymous-TST/knight-errant-TST-zh")
|
74 |
+
tokenizer = MBart50TokenizerFast.from_pretrained("facebook/mbart-large-50", src_lang="zh_CN", tgt_lang="zh_CN")
|
75 |
+
|
76 |
+
article_1 = "jinyong: 接下来会发生什么?"
|
77 |
+
batch = tokenizer(article_1, return_tensors="pt",return_token_type_ids=False, truncation=True, max_length=64, padding=True).to('cuda')
|
78 |
+
translated_tokens = model.generate(**batch,max_length=64)
|
79 |
+
decoded = tokenizer.batch_decode(translated_tokens, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
80 |
+
print(decoded)
|
81 |
+
```
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
```
|