ChatExplorer / dataset_adapters /WizardLMWizardLM_evol_instruct_70k_fubnh.py
thomasgauthier's picture
will this work?
10c1f9c
def transform_data(data):
transformed_data = {}
# get the id
transformation_id = data.get("id", 0) # substitute 0 (or any default) if no id is found
transformed_data["id"] = transformation_id
# split the conversations into separate messages
instructions = data.get("instruction", None)
outputs = data.get("output", None)
# build conversation array
conversations = []
if instructions:
conversations.append({"from": "human", "value":instructions})
if outputs:
conversations.append({"from": "gpt", "value": outputs})
transformed_data["conversations"] = conversations
return transformed_data