Renaming DatasetDict keys>

How do I rename ‘train’ and ‘test’ to ‘test’ and ‘validation’ respectively?

DatasetDict({
train: Dataset({
features: [‘prompt’, ‘completion’],
num_rows: 894082
})
test: Dataset({
features: [‘prompt’, ‘completion’],
num_rows: 383178
})
})

Thank you, dictionaries are getting easier, and somehow harder at the same time lol

DatasetDict is a subclass of dict, so you can do this as follows:

train_ds = dataset_dict.pop("train")
test_ds = dataset_dict.pop("test")

dataset_dict["test"] = train_ds
dataset_dict["validation"] = test_ds

Thank you for this. And thanks for using my examples, helps to understand it better. Much apprciated!