Update README.md
Browse files
README.md
CHANGED
@@ -105,6 +105,7 @@ def answer(text, sample=True, top_p=1, temperature=0.7, context=""):
|
|
105 |
'''sample:是否抽样。生成任务,可以设置为True;
|
106 |
top_p:0-1之间,生成的内容越多样'''
|
107 |
text = f"{context}\n用户:{text}\n小元:"
|
|
|
108 |
text = preprocess(text)
|
109 |
encoding = tokenizer(text=[text], truncation=True, padding=True, max_length=512, return_tensors="pt").to(device)
|
110 |
if not sample:
|
|
|
105 |
'''sample:是否抽样。生成任务,可以设置为True;
|
106 |
top_p:0-1之间,生成的内容越多样'''
|
107 |
text = f"{context}\n用户:{text}\n小元:"
|
108 |
+
text = text.strip()
|
109 |
text = preprocess(text)
|
110 |
encoding = tokenizer(text=[text], truncation=True, padding=True, max_length=512, return_tensors="pt").to(device)
|
111 |
if not sample:
|