Downloads · 30 days
439
29% of all-time downloads
shun89/opus-mt-zh-ja
opus-mt-zh-ja is a machine learning model from shun89. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
from transformers import MarianMTModel, MarianTokenizer
Downloads · 30 days
439
29% of all-time downloads
All-time downloads
1.5K
Public
Repo size
933 MB
Likes
0
Public
Click a slice to open those files.
.bin310 MB · 99%
From the Hugging Face model README
from transformers import MarianMTModel, MarianTokenizer
model = MarianMTModel.from_pretrained(“shun89/opus-mt-zh-ja”)
tokenizer = MarianTokenizer.from_pretrained(“shun89/opus-mt-zh-ja”)
text = '最近,谷歌发布了一则新广告,直接针对苹果最新发布的iOS 26操作系统。'
inputs = tokenizer(texts, return_tensors="pt",padding=True, truncation=True, max_length=256)
outputs = model.generate(**inputs)
result= " ".join(tokenizer.batch_decode(outputs, skip_special_tokens=True))
print("待翻译语句:",text)
print("翻译结果:",result)