Update test_dataset.py
Browse files- test_dataset.py +5 -43
test_dataset.py
CHANGED
|
@@ -56,32 +56,10 @@ _URLS = {
|
|
| 56 |
|
| 57 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
| 58 |
class NewDataset(datasets.GeneratorBasedBuilder):
|
| 59 |
-
"""TODO: Short description of my dataset."""
|
| 60 |
-
|
| 61 |
-
VERSION = datasets.Version("1.1.0")
|
| 62 |
-
|
| 63 |
-
# This is an example of a dataset with multiple configurations.
|
| 64 |
-
# If you don't want/need to define several sub-sets in your dataset,
|
| 65 |
-
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
| 66 |
-
|
| 67 |
-
# If you need to make complex sub-parts in the datasets with configurable options
|
| 68 |
-
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
| 69 |
-
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
| 70 |
-
|
| 71 |
-
# You will be able to load one or the other configurations in the following list with
|
| 72 |
-
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
| 73 |
-
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
| 74 |
-
BUILDER_CONFIGS = [
|
| 75 |
-
datasets.BuilderConfig(name="first_domain", version=VERSION, description="This part of my dataset covers a first domain"),
|
| 76 |
-
datasets.BuilderConfig(name="second_domain", version=VERSION, description="This part of my dataset covers a second domain"),
|
| 77 |
-
]
|
| 78 |
-
|
| 79 |
-
DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 80 |
-
|
| 81 |
def _info(self):
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
features
|
| 85 |
{
|
| 86 |
"year": datasets.Value("int32"),
|
| 87 |
"locationabbr": datasets.Value("string"),
|
|
@@ -96,30 +74,14 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
| 96 |
"life_expectancy": datasets.Value("float32")
|
| 97 |
# These are the features of your dataset like images, labels ...
|
| 98 |
}
|
| 99 |
-
)
|
| 100 |
-
|
| 101 |
-
# This is the description that will appear on the datasets page.
|
| 102 |
-
description=_DESCRIPTION,
|
| 103 |
-
# This defines the different columns of the dataset and their types
|
| 104 |
-
features=features, # Here we define them above because they are different between the two configurations
|
| 105 |
-
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
| 106 |
-
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
| 107 |
-
# supervised_keys=("sentence", "label"),
|
| 108 |
-
# Homepage of the dataset for documentation
|
| 109 |
homepage=_HOMEPAGE,
|
| 110 |
-
# License for the dataset if available
|
| 111 |
license=_LICENSE,
|
| 112 |
-
# Citation for the dataset
|
| 113 |
citation=_CITATION,
|
| 114 |
)
|
| 115 |
|
| 116 |
def _split_generators(self, dl_manager):
|
| 117 |
-
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
| 118 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
| 119 |
-
|
| 120 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
| 121 |
-
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 122 |
-
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 123 |
dl_paths = dl_manager.download_and_extract({
|
| 124 |
'train_csv': 'https://drive.google.com/file/d/1eChYmZ3RMq1v-ek1u6DD2m_dGIrz3sbi/view?usp=sharing'
|
| 125 |
})
|
|
|
|
| 56 |
|
| 57 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
| 58 |
class NewDataset(datasets.GeneratorBasedBuilder):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
def _info(self):
|
| 60 |
+
return datasets.DatasetInfo(
|
| 61 |
+
description=_DESCRIPTION,
|
| 62 |
+
features=datasets.Features(
|
| 63 |
{
|
| 64 |
"year": datasets.Value("int32"),
|
| 65 |
"locationabbr": datasets.Value("string"),
|
|
|
|
| 74 |
"life_expectancy": datasets.Value("float32")
|
| 75 |
# These are the features of your dataset like images, labels ...
|
| 76 |
}
|
| 77 |
+
),
|
| 78 |
+
supervised_keys=None,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
homepage=_HOMEPAGE,
|
|
|
|
| 80 |
license=_LICENSE,
|
|
|
|
| 81 |
citation=_CITATION,
|
| 82 |
)
|
| 83 |
|
| 84 |
def _split_generators(self, dl_manager):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
dl_paths = dl_manager.download_and_extract({
|
| 86 |
'train_csv': 'https://drive.google.com/file/d/1eChYmZ3RMq1v-ek1u6DD2m_dGIrz3sbi/view?usp=sharing'
|
| 87 |
})
|