Spaces:
Runtime error
Runtime error
Update qa_engine/qa_engine.py
Browse files- 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 |
-
|
| 244 |
'Factually: ', 'Answer: ', '<<SYS>>', '<</SYS>>', '[INST]', '[/INST]'
|
| 245 |
]
|
| 246 |
-
|
| 247 |
-
'
|
| 248 |
]
|
| 249 |
-
for seq in
|
| 250 |
answer = answer.replace(seq, '')
|
| 251 |
-
for seq in
|
| 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()
|