Cyantist8208 commited on
Commit
7fba31f
·
1 Parent(s): bd703a0
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -189,8 +189,16 @@ def answer(system: str, context: str, question: str,
189
  top_p=top_p,
190
  top_k=top_k_tok
191
  )
192
- full = tokenizer.decode(output[0], skip_special_tokens=True)
193
- reply = full.split("<|im_start|>assistant")[-1].strip() + prompt
 
 
 
 
 
 
 
 
194
  return reply
195
 
196
  except Exception as e:
 
189
  top_p=top_p,
190
  top_k=top_k_tok
191
  )
192
+ full = tokenizer.decode(output[0], skip_special_tokens=False)
193
+
194
+ start = "<|start_header_id|>assistant<|end_header_id|>\n\n"
195
+ end = "<|eot_id|>"
196
+
197
+ if start in full:
198
+ reply = full.split(start)[-1].split(end)[0].strip()
199
+ else:
200
+ reply = full
201
+
202
  return reply
203
 
204
  except Exception as e: