Spaces:
Sleeping
Sleeping
File size: 439 Bytes
10c1f9c |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
def transform_data(data):
id_value = 1 # You may assign the 'id' value, here I have used 1 for simplicity.
result = {'id': id_value, 'conversations': []}
for key in ('instruction', 'output'):
if key in data:
origin = 'human' if key == 'instruction' else 'gpt'
result['conversations'].append({
'from': origin,
'value': data[key]
})
return result |