lb-data-test / lb-data-test.py
borgholt's picture
haps
f6a7447
raw
history blame
2.01 kB
from typing import Tuple
from typing import Generator
import datasets
from datasets import Value
_DESCRIPTION = """\
...
"""
_URL = "..."
class LaboASRConfig(datasets.BuilderConfig):
def __init__(
self,
do_stuff: bool = False,
**kwargs,
):
super(LaboASRConfig, self).__init__(version=datasets.Version("0.0.1", ""), **kwargs)
self.do_stuff = do_stuff
class LaboASR(datasets.GeneratorBasedBuilder):
CORTI_DATASET_NAME = "labo"
DEFAULT_WRITER_BATCH_SIZE = 256
DEFAULT_CONFIG_NAME = "default"
BUILDER_CONFIG_CLASS = LaboASRConfig
BUILDER_CONFIGS = [
LaboASRConfig(
name="default",
description="Default config.",
),
]
def _info(self):
features = {
"transcript": Value("string"),
"id": Value("string"),
}
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(features),
homepage=_URL,
)
def _split_generators(self, dl_manager):
# return [
# datasets.SplitGenerator(
# name=datasets.Split.TRAIN,
# gen_kwargs={
# "paths": ["1", "2", "3"],
# },
# ),
# datasets.SplitGenerator(
# name=datasets.Split.VALIDATION,
# gen_kwargs={
# "paths": ["4", "5", "6"],
# },
# ),
# ]
return [datasets.SplitGenerator(
name="haps",
gen_kwargs={
"paths": ["1", "2", "3"],
},
)]
def _generate_examples(
self,
paths: list[str],
) -> Generator[Tuple[int, dict], None, None]:
for i, p in enumerate(paths):
# Yield example
example = {
"transcript": "Hello, world!",
"id": "0000" + p,
}
yield i, example