Francisco Castillo commited on
Commit
cb52154
1 Parent(s): fc6af0b
Files changed (1) hide show
  1. reviews_with_drift.py +11 -10
reviews_with_drift.py CHANGED
@@ -106,13 +106,14 @@ class NewDataset(datasets.GeneratorBasedBuilder):
106
  features=features, # Here we define them above because they are different between the two configurations
107
  # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
108
  # specify them. They'll be used if as_supervised=True in builder.as_dataset.
109
- supervised_keys=("text", "label"),
 
110
  # Homepage of the dataset for documentation
111
  # License for the dataset if available
112
  license=_LICENSE,
113
  # Citation for the dataset
114
  citation=_CITATION,
115
- task_templates=[TextClassification(text_column="text", label_column="label")],
116
  )
117
 
118
  def _split_generators(self, dl_manager):
@@ -122,29 +123,29 @@ class NewDataset(datasets.GeneratorBasedBuilder):
122
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
123
  # 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.
124
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
125
- downloaded_files = dl_manager.download_and_extract(_URLS)
126
  return [
127
  datasets.SplitGenerator(
128
- name="training",
129
  # These kwargs will be passed to _generate_examples
130
  gen_kwargs={
131
- "filepath": downloaded_files['training'],
132
  "split": "training",
133
  },
134
  ),
135
  datasets.SplitGenerator(
136
- name="validation",
137
  # These kwargs will be passed to _generate_examples
138
  gen_kwargs={
139
- "filepath": downloaded_files['validation'],
140
- "split": "validation"
141
  },
142
  ),
143
  datasets.SplitGenerator(
144
- name="production",
145
  # These kwargs will be passed to _generate_examples
146
  gen_kwargs={
147
- "filepath": downloaded_files['production'],
148
  "split": "production",
149
  },
150
  ),
 
106
  features=features, # Here we define them above because they are different between the two configurations
107
  # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
108
  # specify them. They'll be used if as_supervised=True in builder.as_dataset.
109
+ # supervised_keys=("text", "label"),
110
+ supervised_keys=None,
111
  # Homepage of the dataset for documentation
112
  # License for the dataset if available
113
  license=_LICENSE,
114
  # Citation for the dataset
115
  citation=_CITATION,
116
+ # task_templates=[TextClassification(text_column="text", label_column="label")],
117
  )
118
 
119
  def _split_generators(self, dl_manager):
 
123
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
124
  # 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.
125
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
126
+ archive = dl_manager.download(_URLS)
127
  return [
128
  datasets.SplitGenerator(
129
+ name=datasets.Split("training"),
130
  # These kwargs will be passed to _generate_examples
131
  gen_kwargs={
132
+ "files": dl_manager.iter_archive(archive),
133
  "split": "training",
134
  },
135
  ),
136
  datasets.SplitGenerator(
137
+ name=datasets.Split.VALIDATION,
138
  # These kwargs will be passed to _generate_examples
139
  gen_kwargs={
140
+ "files": dl_manager.iter_archive(archive),
141
+ "split": "validation",
142
  },
143
  ),
144
  datasets.SplitGenerator(
145
+ name=datasets.Split("production"),
146
  # These kwargs will be passed to _generate_examples
147
  gen_kwargs={
148
+ "files": dl_manager.iter_archive(archive),
149
  "split": "production",
150
  },
151
  ),