Create tmp-two-configs.py
Browse files- tmp-two-configs.py +21 -0
tmp-two-configs.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import datasets
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class NewDataset(datasets.GeneratorBasedBuilder):
|
| 5 |
+
BUILDER_CONFIGS = [
|
| 6 |
+
datasets.BuilderConfig(name="first"),
|
| 7 |
+
datasets.BuilderConfig(name="second"),
|
| 8 |
+
]
|
| 9 |
+
DEFAULT_CONFIG_NAME = "first"
|
| 10 |
+
|
| 11 |
+
def _info(self):
|
| 12 |
+
return datasets.DatasetInfo(
|
| 13 |
+
features=datasets.Features({"text": datasets.Value("string")}),
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
def _split_generators(self, dl_manager):
|
| 17 |
+
return [datasets.SplitGenerator(name=datasets.Split.TRAIN)]
|
| 18 |
+
|
| 19 |
+
def _generate_examples(self):
|
| 20 |
+
for key in range(5):
|
| 21 |
+
yield key, {"text": f"{self.config.name}-{key}"}
|