from datasets import load_dataset | |
# Define the version | |
version = 'original' # latest version of this dataset | |
# Load the dataset with version control | |
dataset = load_dataset('json', data_files={'train': f'{version}/train.jsonl', | |
'validation': f'{version}/valid.jsonl', | |
'test': f'{version}/test.jsonl'}, | |
version=version) | |
# Access the data | |
train_dataset = dataset['train'] | |
valid_dataset = dataset['validation'] | |
test_dataset = dataset['test'] | |
# Example usage | |
for example in train_dataset: | |
print(example['user'], example['assistant']) | |
break | |
# Get the dataset version | |
print(f"Dataset version: {dataset.version}") |