lunarflu HF staff commited on
Commit
9e86d4e
1 Parent(s): 543f2ba

Update qa_engine/qa_engine.py

Browse files
Files changed (1) hide show
  1. qa_engine/qa_engine.py +5 -5
qa_engine/qa_engine.py CHANGED
@@ -240,15 +240,15 @@ class QAEngine():
240
  '''
241
  Preprocess the answer by removing unnecessary sequences and stop sequences.
242
  '''
243
- REMOVE_SEQUENCES = [
244
  'Factually: ', 'Answer: ', '<<SYS>>', '<</SYS>>', '[INST]', '[/INST]'
245
  ]
246
- STOP_SEQUENCES = [
247
- '\nUser:', '\nYou:'
248
  ]
249
- for seq in REMOVE_SEQUENCES:
250
  answer = answer.replace(seq, '')
251
- for seq in STOP_SEQUENCES:
252
  if seq in answer:
253
  answer = answer[:answer.index(seq)]
254
  answer = answer.strip()
 
240
  '''
241
  Preprocess the answer by removing unnecessary sequences and stop sequences.
242
  '''
243
+ SEQUENCES_TO_REMOVE = [
244
  'Factually: ', 'Answer: ', '<<SYS>>', '<</SYS>>', '[INST]', '[/INST]'
245
  ]
246
+ SEQUENCES_TO_STOP = [
247
+ 'User:', 'You:', 'Question:'
248
  ]
249
+ for seq in SEQUENCES_TO_REMOVE:
250
  answer = answer.replace(seq, '')
251
+ for seq in SEQUENCES_TO_STOP:
252
  if seq in answer:
253
  answer = answer[:answer.index(seq)]
254
  answer = answer.strip()