zhaochaofeng commited on
Commit
058886b
·
1 Parent(s): e48e654
Files changed (1) hide show
  1. test.py +0 -13
test.py DELETED
@@ -1,13 +0,0 @@
1
- from transformers import AutoTokenizer
2
- from transformers import AutoModelForSeq2SeqLM
3
-
4
- model = 'zhaochaofeng/chat-t5'
5
- tokenizer = AutoTokenizer.from_pretrained(model)
6
- model = AutoModelForSeq2SeqLM.from_pretrained(model)
7
-
8
- txt = '请介绍一下什么是机器学习'
9
- inputs = tokenizer(text=txt, return_tensors='pt')
10
- outputs = model.generate(inputs=inputs.input_ids, max_new_tokens=300, do_sample=True)
11
- res = tokenizer.batch_decode(sequences=outputs, skip_special_tokens=True)
12
- print(res)
13
-