Download dataset.py from n1404361306/bgp: direct link, hf CLI and curl.
- Browser
- Download file 953 Bytes
-
https://huggingface.co/datasets/n1404361306/bgp/resolve/main/dataset.py
- Command line
-
hf download hf://datasets/n1404361306/bgp/dataset.py
-
curl -L -o dataset.py https://huggingface.co/datasets/n1404361306/bgp/resolve/main/dataset.py
953 Bytes
| import datasets | |
| class MyDataset(datasets.GeneratorBasedBuilder): | |
| def _info(self): | |
| return datasets.DatasetInfo( | |
| features=datasets.Features({ | |
| "client_id": datasets.Value("string"), | |
| "path": datasets.Audio(sampling_rate=16000), # 👈 音频列 | |
| "sentence_id": datasets.Value("string"), | |
| "sentence": datasets.Value("string"), | |
| "locale": datasets.Value("string"), | |
| }) | |
| ) | |
| def _split_generators(self, dl_manager): | |
| return [ | |
| datasets.SplitGenerator( | |
| name=datasets.Split.TRAIN, | |
| gen_kwargs={"filepath": "data.tsv"}, | |
| ), | |
| ] | |
| def _generate_examples(self, filepath): | |
| import csv | |
| with open(filepath, encoding="utf-8") as f: | |
| reader = csv.DictReader(f, delimiter="\t") | |
| for i, row in enumerate(reader): | |
| yield i, row | |