mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-08-11 05:38:55 +08:00
19 lines
701 B
Python
19 lines
701 B
Python
import re
|
|
|
|
re_reference_remove = re.compile(r'\[([0-9])+\]|\[([0-9])+,([0-9])+\]')
|
|
|
|
def webgpt_return_format(row):
|
|
if row['score_0'] >= row['score_1']:
|
|
# remove this to prevent information leak, since we are not using reference
|
|
return {
|
|
'question': row['question']['full_text'],
|
|
'pos': re_reference_remove.sub('', row['answer_0']),
|
|
'neg': re_reference_remove.sub('', row['answer_1'])
|
|
}
|
|
|
|
return {
|
|
'question': row['question']['full_text'],
|
|
'pos': re_reference_remove.sub('', row['answer_1']),
|
|
'neg': re_reference_remove.sub('', row['answer_0'])
|
|
}
|