模型:
optimum/t5-small
T5 是一个编码器-解码器模型,它在多个无监督和有监督任务上进行预训练,每个任务都被转换为文本到文本的格式。
欲获取更多信息,请查看原始论文。
论文: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
作者:Colin Raffel,Noam Shazeer,Adam Roberts,Katherine Lee,Sharan Narang,Michael Matena,Yanqi Zhou,Wei Li,Peter J. Liu
您可以使用此模型与 Transformers pipeline。
from transformers import AutoTokenizer, pipeline from optimum.onnxruntime import ORTModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("optimum/t5-small") model = ORTModelForSeq2SeqLM.from_pretrained("optimum/t5-small") translator = pipeline("translation_en_to_fr", model=model, tokenizer=tokenizer) results = translator("My name is Eustache and I have a pet raccoon") print(results)