iryneko571
commited on
Commit
•
caa5c2c
1
Parent(s):
162556a
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- iryneko571/CCMatrix-v1-Ja_Zh-fused
|
5 |
+
language:
|
6 |
+
- ja
|
7 |
+
- zh
|
8 |
+
library_name: transformers
|
9 |
+
pipeline_tag: translation
|
10 |
+
widget:
|
11 |
+
- text: <-ja2zh-> フェルディナント・ラッサール \n は、プロイセンの政治学者、哲学者、法学者、社会主義者、労働運動指導者。ドイツ社会民主党の母体となる全ドイツ労働者同盟の創設者である。社会主義共和政の統一ドイツを目指しつつも、……
|
12 |
+
---
|
13 |
+
# 测试用colab笔记,test notebook
|
14 |
+
不需要自己装环境即可使用!!No environment needed, use colab to test
|
15 |
+
https://colab.research.google.com/drive/1PA30HPgRooCTV-H9Wr_DZXHqC42PrgTO?usp=sharing
|
16 |
+
现在翻译能力就是人工吗喽,不是词汇不够,是学不会了
|
17 |
+
this model has problem learning more due to the 300M size and my poor techniques
|
18 |
+
# 模型公开声明
|
19 |
+
* 这个模型由 mt5-translation-ja_zh 启发(其实就是在它上面改的),使用mt5-small,整体较小
|
20 |
+
* 使用了CCMatrix-v1-Ja_Zh, 1e-4学习率, 7 个epoch, 大概1.7的 val loss,下不去了
|
21 |
+
# Release Notes
|
22 |
+
* this model is finetuned from mt5-small, training methods and datasets refers to larryvrh/mt5-translation-ja_zh
|
23 |
+
* used a trimmed and fused dataset CCMatrix-v1-Ja_Zh 1e-4 for 7 epoch no weight decay,arraived at about 1.7 val loss, it somehow stalls there
|
24 |
+
# A more precise example using it
|
25 |
+
# 使用指南
|
26 |
+
```python
|
27 |
+
from transformers import pipeline
|
28 |
+
model_name="iryneko571/mt5-small-translation-ja_zh"
|
29 |
+
#pipe = pipeline("translation",model=model_name,tokenizer=model_name,repetition_penalty=1.4,batch_size=1,max_length=256)
|
30 |
+
pipe = pipeline("translation",
|
31 |
+
model=model_name,
|
32 |
+
repetition_penalty=1.4,
|
33 |
+
batch_size=1,
|
34 |
+
max_length=256
|
35 |
+
)
|
36 |
+
|
37 |
+
def translate_batch(batch, language='<-ja2zh->'): # batch is an array of string
|
38 |
+
i=0 # quickly format the list
|
39 |
+
while i<len(batch):
|
40 |
+
batch[i]=f'{language} {batch[i]}'
|
41 |
+
i+=1
|
42 |
+
translated=pipe(batch)
|
43 |
+
result=[]
|
44 |
+
i=0
|
45 |
+
while i<len(translated):
|
46 |
+
result.append(translated[i]['translation_text'])
|
47 |
+
i+=1
|
48 |
+
return result
|
49 |
+
|
50 |
+
inputs=[]
|
51 |
+
|
52 |
+
print(translate_batch(inputs))
|