File size: 775 Bytes
d842e6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from datasets import (
    load_dataset,
    disable_caching,
    get_dataset_split_names,
    get_dataset_config_names,
)
from transformers import AutoTokenizer

disable_caching()

SCRIPT = "./imdb_dutch.py"


def test_get_split_names():
    splits = get_dataset_split_names(SCRIPT, "plain_text")
    assert splits == ["train", "test", "unsupervised"]


def test_get_config_names():
    configs = get_dataset_config_names(SCRIPT)
    assert configs == ["plain_text"]


def test_streaming_dataset():
    datasets = load_dataset(SCRIPT, streaming=True)
    train_ds = datasets["train"]

    i = iter(train_ds)
    e = next(i)

    val_ds = datasets["test"]

    i = iter(val_ds)
    e = next(i)

    unsup_ds = datasets["unsupervised"]

    i = iter(unsup_ds)
    e = next(i)