Instructions to use liam168/trans-opus-mt-zh-en with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use liam168/trans-opus-mt-zh-en with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="liam168/trans-opus-mt-zh-en")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("liam168/trans-opus-mt-zh-en") model = AutoModelForSeq2SeqLM.from_pretrained("liam168/trans-opus-mt-zh-en") - Notebooks
- Google Colab
- Kaggle
liam168/trans-opus-mt-zh-en
Model description
- source group: English
- target group: Chinese
- model: transformer
- source language(s): eng
How to use
>>> from transformers import AutoModelWithLMHead,AutoTokenizer,pipeline
>>> mode_name = 'liam168/trans-opus-mt-zh-en'
>>> model = AutoModelWithLMHead.from_pretrained(mode_name)
>>> tokenizer = AutoTokenizer.from_pretrained(mode_name)
>>> translation = pipeline("translation_zh_to_en", model=model, tokenizer=tokenizer)
>>> translation('我喜欢学习数据科学和机器学习。', max_length=400)
[{'translation_text': 'I like to study data science and machine learning.'}]
Contact
- Downloads last month
- 145