chat-t5 / README.md
zhaochaofeng's picture
README.md
e48e654

T5中文对话模型

快速使用

from transformers import AutoTokenizer
from transformers import AutoModelForSeq2SeqLM

model = 'zhaochaofeng/chat-t5'
tokenizer = AutoTokenizer.from_pretrained(model)
model = AutoModelForSeq2SeqLM.from_pretrained(model)

txt = '请介绍一下什么是机器学习'
inputs = tokenizer(text=txt, return_tensors='pt')
outputs = model.generate(inputs=inputs.input_ids, max_new_tokens=300, do_sample=True)
res = tokenizer.batch_decode(sequences=outputs, skip_special_tokens=True)
print(res)