ClueAI commited on
Commit
4a7a6a3
1 Parent(s): 00e8a53

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -0
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: