File size: 727 Bytes
4e2027c
 
 
 
 
 
5da6fa2
 
 
4e2027c
 
 
 
 
 
 
 
 
5da6fa2
4e2027c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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}")