Downloads · 30 days
89
6% of all-time downloads
iryneko571/mt5-small-translation-ja_zh
mt5-small-translation-ja_zh is a translation model from iryneko571. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as mit.
不需要自己装环境即可使用!!No environment needed, use colab to test <br https://colab.research.google.com/drive/1PA30HPgRooCTV-H9WrDZXHqC42PrgTO?usp=sharing <br 现在翻译能力就是人工吗喽,不是词汇不够,是学不会了 <br this model has problem learning more du…
Downloads · 30 days
89
6% of all-time downloads
All-time downloads
1.5K
Public
Parameters
300M
1.2 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.2 GB · 100%
From the Hugging Face model README
不需要自己装环境即可使用!!No environment needed, use colab to test <br> https://colab.research.google.com/drive/1PA30HPgRooCTV-H9Wr_DZXHqC42PrgTO?usp=sharing <br> 现在翻译能力就是人工吗喽,不是词汇不够,是学不会了 <br> this model has problem learning more due to the 300M size and my poor techniques
from transformers import pipeline
model_name="iryneko571/mt5-small-translation-ja_zh"
#pipe = pipeline("translation",model=model_name,tokenizer=model_name,repetition_penalty=1.4,batch_size=1,max_length=256)
pipe = pipeline("translation",
model=model_name,
repetition_penalty=1.4,
batch_size=1,
max_length=256
)
def translate_batch(batch, language='<-ja2zh->'): # batch is an array of string
i=0 # quickly format the list
while i<len(batch):
batch[i]=f'{language} {batch[i]}'
i+=1
translated=pipe(batch)
result=[]
i=0
while i<len(translated):
result.append(translated[i]['translation_text'])
i+=1
return result
inputs=[]
print(translate_batch(inputs))