ChatExplorer / dataset_adapters /WizardLMWizardLM_evol_instruct_70k_2.py
thomasgauthier's picture
will this work?
10c1f9c
raw
history blame
462 Bytes
def transform_data(data):
transformed_data = {'id': 1, 'conversations': []}
id_counter = 1
for key, value in data.items():
if key == 'instruction':
transformed_data['conversations'].append({'from': 'human', 'value': value})
elif key == 'output':
transformed_data['conversations'].append({'from': 'gpt', 'value': value})
transformed_data['id'] = id_counter
id_counter += 1
return transformed_data