File size: 2,008 Bytes
0246d97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import datasets
from datasets import DatasetInfo, DownloadManager

from NASA_OSDR import NasaOsdr


def test_inherit_generator_base_builder_works():
    class Child(datasets.GeneratorBasedBuilder):
        BUILDER_CONFIGS = [
            datasets.BuilderConfig(
                name="some dataset",
                version=datasets.Version("1.0.0"),
                description="some description",
            )
        ]

        DEFAULT_CONFIG_NAME = "some dataset"

        def _info(self) -> DatasetInfo:
            return datasets.DatasetInfo(
                description="""dadada """,
                features=None,
                supervised_keys=None,
                homepage="dada",
                license="dada",
                citation="dsada",
            )

    child = Child()

    assert child


def test_generate_examples():
    dataset = NasaOsdr(name='experiments')
    train_data = dataset._generate_examples(file='data/train/experiments.csv')
    idx, sample = next(iter(train_data))
    print(idx, sample.keys())

    dataset = NasaOsdr(name='samples')
    train_data = dataset._generate_examples(file='data/train/samples.csv')
    idx, sample = next(iter(train_data))
    print(idx, sample.keys())


def test_load_dataset():
    from datasets import load_dataset
    experiments_dataset = load_dataset("nasa_osdr.py", "experiments")
    print(len(experiments_dataset["train"]))
    print(experiments_dataset['train'][:10])

    samples_dataset = load_dataset("nasa_osdr.py", "samples")
    print(len(samples_dataset["train"]))
    print(samples_dataset['train'][:10])


# def test_load_dataset2():
#     from datasets import load_dataset
#     dataset = load_dataset("anz2/NASA_OSDR", "experiments", use_auth_token="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")
#     print(len(dataset["train"]))

#     from datasets import load_dataset
#     dataset = load_dataset("anz2/NASA_OSDR", "samples", use_auth_token="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")
#     print(len(dataset["train"]))