gcjavi commited on
Commit
40c2058
1 Parent(s): c567fa8

deleted script

Browse files
Files changed (1) hide show
  1. dataviewer-test.py +0 -129
dataviewer-test.py DELETED
@@ -1,129 +0,0 @@
1
- # coding=utf-8
2
- # Lint as: python3
3
- """test set"""
4
-
5
-
6
- import csv
7
- import os
8
- import json
9
-
10
- import datasets
11
- from datasets.utils.py_utils import size_str
12
- from tqdm import tqdm
13
- from datasets.tasks import AutomaticSpeechRecognition
14
-
15
-
16
- _CITATION = """\
17
- @inproceedings{panayotov2015librispeech,
18
- title={Librispeech: an ASR corpus based on public domain audio books},
19
- author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},
20
- booktitle={Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on},
21
- pages={5206--5210},
22
- year={2015},
23
- organization={IEEE}
24
- }
25
- """
26
-
27
- _DESCRIPTION = """\
28
- Lorem ipsum
29
- """
30
-
31
-
32
- _BASE_URL = "https://huggingface.co/datasets/polinaeterna/test-user"
33
- _DATA_URL = "data/test.zip"
34
- _PROMPTS_URLS = {"test": "transcript/test.tsv"}
35
-
36
- logger = datasets.logging.get_logger(__name__)
37
-
38
- class TestConfig(datasets.BuilderConfig):
39
- """Lorem impsum."""
40
-
41
- def __init__(self, name, **kwargs):
42
- # self.language = kwargs.pop("language", None)
43
- # self.release_date = kwargs.pop("release_date", None)
44
- # self.num_clips = kwargs.pop("num_clips", None)
45
- # self.num_speakers = kwargs.pop("num_speakers", None)
46
- # self.validated_hr = kwargs.pop("validated_hr", None)
47
- # self.total_hr = kwargs.pop("total_hr", None)
48
- # self.size_bytes = kwargs.pop("size_bytes", None)
49
- # self.size_human = size_str(self.size_bytes)
50
- description = (
51
- f"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor "
52
- f"incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud "
53
- f"exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure "
54
- f"dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. "
55
- f"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
56
- f"mollit anim id est laborum."
57
- )
58
- super(TestConfig, self).__init__(
59
- name=name,
60
- description=description,
61
- **kwargs,
62
- )
63
-
64
- class TestASR(datasets.GeneratorBasedBuilder):
65
- """Lorem ipsum."""
66
-
67
-
68
- BUILDER_CONFIGS = [
69
- TestConfig(
70
- name="dataviewer-test",
71
- )
72
- ]
73
-
74
- def _info(self):
75
- return datasets.DatasetInfo(
76
- description=_DESCRIPTION,
77
- features=datasets.Features(
78
- {
79
- "audio_id": datasets.Value("string"),
80
- "audio": datasets.Audio(),
81
- "ngram": datasets.Value("string")
82
- }
83
- ),
84
- supervised_keys=None,
85
- homepage=_BASE_URL,
86
- citation=_CITATION,
87
- task_templates=[
88
- AutomaticSpeechRecognition(transcription_column="ngram")
89
- ],
90
- )
91
-
92
- def _split_generators(self, dl_manager):
93
- audio_path = dl_manager.download(_DATA_URL)
94
- local_extracted_archive = dl_manager.extract(audio_path) if not dl_manager.is_streaming else None
95
- meta_path = dl_manager.download(_PROMPTS_URLS)
96
- return [datasets.SplitGenerator(
97
- name=datasets.Split.TEST,
98
- gen_kwargs={
99
- "meta_path": meta_path["test"],
100
- "audio_files": dl_manager.iter_archive(audio_path),
101
- "local_extracted_archive": local_extracted_archive,
102
- }
103
- )]
104
-
105
- def _generate_examples(self, meta_path, audio_files, local_extracted_archive):
106
- """Lorem ipsum."""
107
- data_fields = list(self._info().features.keys())
108
- metadata = {}
109
- with open(meta_path, encoding="utf-8") as f:
110
- next(f)
111
- for row in f:
112
- print(row)
113
- r = row.split("\t")
114
- print(r)
115
- audio_id = r[0]
116
- ngram = r[1]
117
- metadata[audio_id] = {"audio_id": audio_id,
118
- "ngram": ngram}
119
-
120
- id_ = 0
121
- for path, f in audio_files:
122
- print(path, f)
123
- _, audio_name = os.path.split(path)
124
- if audio_name in metadata:
125
- result = dict(metadata[audio_name])
126
- path = os.path.join(local_extracted_archive, "test", path) if local_extracted_archive else path
127
- result["audio"] = {"path": path, "bytes":f.read()}
128
- yield id_, result
129
- id_ +=1