Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

问一下t5预训练模型如何推理 #355

Open
zhangzai666 opened this issue Mar 15, 2023 · 0 comments
Open

问一下t5预训练模型如何推理 #355

zhangzai666 opened this issue Mar 15, 2023 · 0 comments

Comments

@zhangzai666
Copy link

尊敬的作者您好!
看了您的代码我受益匪浅,下面有一个问题请您指教,
我看到[Hugging Face]中有关T5预训练模型的推理代码,直接用transformers库推理的,如下:
from transformers import BertTokenizer, T5ForConditionalGeneration, Text2TextGenerationPipeline
tokenizer = BertTokenizer.from_pretrained("uer/t5-small-chinese-cluecorpussmall")
model = T5ForConditionalGeneration.from_pretrained("uer/t5-small-chinese-cluecorpussmall")
text2text_generator = Text2TextGenerationPipeline(model, tokenizer)
text2text_generator("中国的首都是extra0京", max_length=50, do_sample=False)
[{'generated_text': 'extra0 北 extra1 extra2 extra3 extra4 extra5'}]
请问一下UER风格的预训练T5模型如何推理,得到类似上面的效果?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant