I have a list of dictionaries:
print(type(train_dataset))
>>> <class 'list'>
print(len(train_dataset))
>>> 4000
train_dataset[0]
>>>
{'id': '7',
'question': {'stem': 'Who is A',
'choices': [{'text': 'A is X', 'label': 'A'},
{'text': 'A is not B', 'label': 'D'}]},
'answerKey': 'D'}
How can I convert this to a huggingface Dataset object? From their website it seems like you can only convert pandas df (dataset = Dataset.from_pandas(df)
) or a dictionary ( dataset = Dataset.from_dict(my_dict)
), but it's not clear how to use a list of dictionaries