模型:
unicamp-dl/translation-en-pt-t5
这个存储库提供了使用一种简单的硬件设置进行EN-PT任务的T5翻译实现。我们提出了一些在分词器和后处理中改进结果的变化,并使用了一个葡萄牙语预训练模型进行翻译。您可以在 our repository 中收集更多信息。同时,请查看 our paper !
只需按照“在Transformers中使用”说明进行操作。在将任务定义给T5之前,需要添加一些单词。
您还可以为其创建一个流水线。一个使用短语“我喜欢吃米饭”的示例是:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline tokenizer = AutoTokenizer.from_pretrained("unicamp-dl/translation-en-pt-t5") model = AutoModelForSeq2SeqLM.from_pretrained("unicamp-dl/translation-en-pt-t5") enpt_pipeline = pipeline('text2text-generation', model=model, tokenizer=tokenizer) enpt_pipeline("translate English to Portuguese: I like to eat rice.")
@inproceedings{lopes-etal-2020-lite, title = "Lite Training Strategies for {P}ortuguese-{E}nglish and {E}nglish-{P}ortuguese Translation", author = "Lopes, Alexandre and Nogueira, Rodrigo and Lotufo, Roberto and Pedrini, Helio", booktitle = "Proceedings of the Fifth Conference on Machine Translation", month = nov, year = "2020", address = "Online", publisher = "Association for Computational Linguistics", url = "https://www.aclweb.org/anthology/2020.wmt-1.90", pages = "833--840", }