Sh1man commited on
Commit
8924674
·
1 Parent(s): cc8f018

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -57,3 +57,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ transcript/crowd/train.tsv filter=lfs diff=lfs merge=lfs -text
61
+ transcript/farfield/train.tsv filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,223 +1,71 @@
1
- ---
2
- license: other
3
- license_link: https://github.com/salute-developers/golos/blob/master/license/ru.pdf
4
- dataset_info:
5
- - config_name: test_crowd_chunk_0
6
- features:
7
- - name: id
8
- dtype: string
9
- - name: audio
10
- dtype:
11
- audio:
12
- sampling_rate: 16000
13
- - name: text
14
- dtype: string
15
- - name: duration
16
- dtype: float32
17
- - name: source
18
- dtype: string
19
- splits:
20
- - name: train
21
- num_bytes: 174005420.684
22
- num_examples: 9994
23
- download_size: 171247463
24
- dataset_size: 174005420.684
25
- - config_name: test_farfield_chunk_0
26
- features:
27
- - name: id
28
- dtype: string
29
- - name: audio
30
- dtype:
31
- audio:
32
- sampling_rate: 16000
33
- - name: text
34
- dtype: string
35
- - name: duration
36
- dtype: float32
37
- - name: source
38
- dtype: string
39
- splits:
40
- - name: train
41
- num_bytes: 22773121.4
42
- num_examples: 1916
43
- download_size: 20748082
44
- dataset_size: 22773121.4
45
- - config_name: train_crowd_chunk_0
46
- features:
47
- - name: id
48
- dtype: string
49
- - name: audio
50
- dtype:
51
- audio:
52
- sampling_rate: 16000
53
- - name: text
54
- dtype: string
55
- - name: duration
56
- dtype: float32
57
- - name: source
58
- dtype: string
59
- splits:
60
- - name: train
61
- num_bytes: 3543023006.0
62
- num_examples: 200000
63
- download_size: 3348370117
64
- dataset_size: 3543023006.0
65
- - config_name: train_crowd_chunk_1
66
- features:
67
- - name: id
68
- dtype: string
69
- - name: audio
70
- dtype:
71
- audio:
72
- sampling_rate: 16000
73
- - name: text
74
- dtype: string
75
- - name: duration
76
- dtype: float32
77
- - name: source
78
- dtype: string
79
- splits:
80
- - name: train
81
- num_bytes: 3955337318.0
82
- num_examples: 200000
83
- download_size: 3286435754
84
- dataset_size: 3955337318.0
85
- - config_name: train_crowd_chunk_2
86
- features:
87
- - name: id
88
- dtype: string
89
- - name: audio
90
- dtype:
91
- audio:
92
- sampling_rate: 16000
93
- - name: text
94
- dtype: string
95
- - name: duration
96
- dtype: float32
97
- - name: source
98
- dtype: string
99
- splits:
100
- - name: train
101
- num_bytes: 4217539962.0
102
- num_examples: 200000
103
- download_size: 3833360601
104
- dataset_size: 4217539962.0
105
- - config_name: train_crowd_chunk_3
106
- features:
107
- - name: id
108
- dtype: string
109
- - name: audio
110
- dtype:
111
- audio:
112
- sampling_rate: 16000
113
- - name: text
114
- dtype: string
115
- - name: duration
116
- dtype: float32
117
- - name: source
118
- dtype: string
119
- splits:
120
- - name: train
121
- num_bytes: 5302673779.0
122
- num_examples: 200000
123
- download_size: 3744720070
124
- dataset_size: 5302673779.0
125
- - config_name: train_crowd_chunk_4
126
- features:
127
- - name: id
128
- dtype: string
129
- - name: audio
130
- dtype:
131
- audio:
132
- sampling_rate: 16000
133
- - name: text
134
- dtype: string
135
- - name: duration
136
- dtype: float32
137
- - name: source
138
- dtype: string
139
- splits:
140
- - name: train
141
- num_bytes: 3259869309.996
142
- num_examples: 179796
143
- download_size: 2598124991
144
- dataset_size: 3259869309.996
145
- - config_name: train_farfield_chunk_0
146
- features:
147
- - name: id
148
- dtype: string
149
- - name: audio
150
- dtype:
151
- audio:
152
- sampling_rate: 16000
153
- - name: text
154
- dtype: string
155
- - name: duration
156
- dtype: float32
157
- - name: source
158
- dtype: string
159
- splits:
160
- - name: train
161
- num_bytes: 2858014558.777
162
- num_examples: 124003
163
- download_size: 1940591595
164
- dataset_size: 2858014558.777
165
- configs:
166
- - config_name: test_crowd_chunk_0
167
- data_files:
168
- - split: train
169
- path: test_crowd_chunk_0/train-*
170
- - config_name: test_farfield_chunk_0
171
- data_files:
172
- - split: train
173
- path: test_farfield_chunk_0/train-*
174
- - config_name: train_crowd_chunk_0
175
- data_files:
176
- - split: train
177
- path: train_crowd_chunk_0/train-*
178
- - config_name: train_crowd_chunk_1
179
- data_files:
180
- - split: train
181
- path: train_crowd_chunk_1/train-*
182
- - config_name: train_crowd_chunk_2
183
- data_files:
184
- - split: train
185
- path: train_crowd_chunk_2/train-*
186
- - config_name: train_crowd_chunk_3
187
- data_files:
188
- - split: train
189
- path: train_crowd_chunk_3/train-*
190
- - config_name: train_crowd_chunk_4
191
- data_files:
192
- - split: train
193
- path: train_crowd_chunk_4/train-*
194
- - config_name: train_farfield_chunk_0
195
- data_files:
196
- - split: train
197
- path: train_farfield_chunk_0/train-*
198
- ---
199
-
200
- Licensing Information
201
-
202
-
203
- English Version
204
- https://github.com/salute-developers/golos/blob/master/license/en_us.pdf
205
-
206
- Russian Version
207
- https://github.com/salute-developers/golos/blob/master/license/ru.pdf
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  ```
210
- @inproceedings{karpov21_interspeech,
211
- author={Nikolay Karpov and Alexander Denisenko and Fedor Minkin},
212
- title={{Golos: Russian Dataset for Speech Research}},
213
- year=2021,
214
- booktitle={Proc. Interspeech 2021},
215
- pages={1419--1423},
216
- doi={10.21437/Interspeech.2021-462}
217
- }/github.com/salute-developers/golos/blob/master/license/en_us.pdf
218
 
219
- Russian Version
220
- https://github.com/salute-developers/golos/blob/master/license/ru.pdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
 
222
  ```
223
  @inproceedings{karpov21_interspeech,
@@ -227,4 +75,5 @@ https://github.com/salute-developers/golos/blob/master/license/ru.pdf
227
  booktitle={Proc. Interspeech 2021},
228
  pages={1419--1423},
229
  doi={10.21437/Interspeech.2021-462}
230
- }
 
 
1
+ # GOLOS OPUS Dataset
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ ## Dataset Description
4
+
5
+ GOLOS is a Russian dataset for speech research. This is the OPUS version of the GOLOS dataset.
6
+
7
+ ## Subsets
8
+
9
+ The dataset contains two subsets:
10
+ - **crowd**: Crowd-sourced recordings
11
+ - **farfield**: Far-field recordings
12
+
13
+ ## Dataset Structure
14
+
15
+ This dataset is organized in the Common Voice format:
16
+
17
+ - `/audio/{subset}/{split}/` - Contains TAR files with audio files
18
+ - `/transcript/{subset}/` - Contains TSV files with transcriptions
19
+ - `/n_shards.json` - Contains information about the number of shards for each subset and split
20
+
21
+ ## Usage
22
+
23
+ ```python
24
+ from datasets import load_dataset
25
+ from torch.utils.data import DataLoader
26
+
27
+ # Загрузка crowd подмножества, тренировочного сплита
28
+ dataset = load_dataset("Sh1man/golos_opus", "crowd", split="train")
29
+
30
+ # Или использование всего датасета
31
+ dataset = load_dataset("Sh1man/golos_opus", "crowd")
32
+ train_dataset = dataset["train"]
33
+ test_dataset = dataset["test"]
34
+
35
+ # Создание DataLoader
36
+ dataloader = DataLoader(dataset, batch_size=32)
37
+
38
+ # Доступ к данным
39
+ for batch in dataloader:
40
+ print(batch["audio"])
41
+ print(batch["text"])
42
  ```
 
 
 
 
 
 
 
 
43
 
44
+ ## Dataset Statistics
45
+
46
+
47
+ ### crowd subset
48
+
49
+ | Split | Samples | Hours |
50
+ |-------|---------|-------|
51
+ | train | 979796 | 1094.99 |
52
+ | test | 9994 | 11.20 |
53
+ | **Total** | **989790** | **1106.19** |
54
+
55
+ ### farfield subset
56
+
57
+ | Split | Samples | Hours |
58
+ |-------|---------|-------|
59
+ | train | 124003 | 132.46 |
60
+ | test | 1916 | 1.41 |
61
+ | **Total** | **125919** | **133.87** |
62
+
63
+ ## License
64
+
65
+ English Version: https://github.com/salute-developers/golos/blob/master/license/en_us.pdf
66
+ Russian Version: https://github.com/salute-developers/golos/blob/master/license/ru.pdf
67
+
68
+ ## Citation
69
 
70
  ```
71
  @inproceedings{karpov21_interspeech,
 
75
  booktitle={Proc. Interspeech 2021},
76
  pages={1419--1423},
77
  doi={10.21437/Interspeech.2021-462}
78
+ }
79
+ ```
dataset_infos/crowd.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crowd": {
3
+ "description": "GOLOS OPUS Russian speech dataset - crowd subset",
4
+ "citation": "@inproceedings{karpov21_interspeech,\n author={Nikolay Karpov and Alexander Denisenko and Fedor Minkin},\n title={{Golos: Russian Dataset for Speech Research}},\n year=2021,\n booktitle={Proc. Interspeech 2021},\n pages={1419--1423},\n doi={10.21437/Interspeech.2021-462}\n}",
5
+ "homepage": "https://github.com/salute-developers/golos",
6
+ "license": "CC-BY 4.0",
7
+ "features": {
8
+ "id": {
9
+ "dtype": "string",
10
+ "id": null,
11
+ "_type": "Value"
12
+ },
13
+ "path": {
14
+ "dtype": "string",
15
+ "id": null,
16
+ "_type": "Value"
17
+ },
18
+ "text": {
19
+ "dtype": "string",
20
+ "id": null,
21
+ "_type": "Value"
22
+ },
23
+ "duration": {
24
+ "dtype": "float32",
25
+ "id": null,
26
+ "_type": "Value"
27
+ },
28
+ "audio": {
29
+ "sampling_rate": 16000,
30
+ "id": null,
31
+ "_type": "Audio"
32
+ }
33
+ },
34
+ "post_processed": null,
35
+ "supervised_keys": null,
36
+ "task_templates": [
37
+ {
38
+ "task": "automatic-speech-recognition",
39
+ "audio_column": "audio",
40
+ "transcription_column": "text"
41
+ }
42
+ ],
43
+ "builder_name": "golos_opus",
44
+ "config_name": "crowd",
45
+ "version": {
46
+ "version_str": "1.0.0",
47
+ "description": null,
48
+ "major": 1,
49
+ "minor": 0,
50
+ "patch": 0
51
+ },
52
+ "splits": {
53
+ "train": {
54
+ "name": "train",
55
+ "num_bytes": null,
56
+ "num_examples": 979796,
57
+ "dataset_name": "golos_opus.crowd"
58
+ },
59
+ "test": {
60
+ "name": "test",
61
+ "num_bytes": null,
62
+ "num_examples": 9994,
63
+ "dataset_name": "golos_opus.crowd"
64
+ }
65
+ },
66
+ "download_checksums": {},
67
+ "download_size": null,
68
+ "post_processing_size": null,
69
+ "dataset_size": null,
70
+ "size_in_bytes": null
71
+ }
72
+ }
dataset_infos/farfield.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "farfield": {
3
+ "description": "GOLOS OPUS Russian speech dataset - farfield subset",
4
+ "citation": "@inproceedings{karpov21_interspeech,\n author={Nikolay Karpov and Alexander Denisenko and Fedor Minkin},\n title={{Golos: Russian Dataset for Speech Research}},\n year=2021,\n booktitle={Proc. Interspeech 2021},\n pages={1419--1423},\n doi={10.21437/Interspeech.2021-462}\n}",
5
+ "homepage": "https://github.com/salute-developers/golos",
6
+ "license": "CC-BY 4.0",
7
+ "features": {
8
+ "id": {
9
+ "dtype": "string",
10
+ "id": null,
11
+ "_type": "Value"
12
+ },
13
+ "path": {
14
+ "dtype": "string",
15
+ "id": null,
16
+ "_type": "Value"
17
+ },
18
+ "text": {
19
+ "dtype": "string",
20
+ "id": null,
21
+ "_type": "Value"
22
+ },
23
+ "duration": {
24
+ "dtype": "float32",
25
+ "id": null,
26
+ "_type": "Value"
27
+ },
28
+ "audio": {
29
+ "sampling_rate": 16000,
30
+ "id": null,
31
+ "_type": "Audio"
32
+ }
33
+ },
34
+ "post_processed": null,
35
+ "supervised_keys": null,
36
+ "task_templates": [
37
+ {
38
+ "task": "automatic-speech-recognition",
39
+ "audio_column": "audio",
40
+ "transcription_column": "text"
41
+ }
42
+ ],
43
+ "builder_name": "golos_opus",
44
+ "config_name": "farfield",
45
+ "version": {
46
+ "version_str": "1.0.0",
47
+ "description": null,
48
+ "major": 1,
49
+ "minor": 0,
50
+ "patch": 0
51
+ },
52
+ "splits": {
53
+ "train": {
54
+ "name": "train",
55
+ "num_bytes": null,
56
+ "num_examples": 124003,
57
+ "dataset_name": "golos_opus.farfield"
58
+ },
59
+ "test": {
60
+ "name": "test",
61
+ "num_bytes": null,
62
+ "num_examples": 1916,
63
+ "dataset_name": "golos_opus.farfield"
64
+ }
65
+ },
66
+ "download_checksums": {},
67
+ "download_size": null,
68
+ "post_processing_size": null,
69
+ "dataset_size": null,
70
+ "size_in_bytes": null
71
+ }
72
+ }
golos_opus.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2023 The HuggingFace Datasets Authors and the GOLOS OPUS dataset creators.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ import csv
17
+ import json
18
+ import os
19
+ from pathlib import Path
20
+ from typing import Dict, List, Tuple
21
+
22
+ import datasets
23
+
24
+ logger = datasets.logging.get_logger(__name__)
25
+
26
+ _DESCRIPTION = '''
27
+ GOLOS is a Russian dataset for speech research.
28
+ This is the OPUS version of the GOLOS dataset.
29
+ '''
30
+
31
+ _CITATION = '''
32
+ @inproceedings{karpov21_interspeech,
33
+ author={Nikolay Karpov and Alexander Denisenko and Fedor Minkin},
34
+ title={{Golos: Russian Dataset for Speech Research}},
35
+ year=2021,
36
+ booktitle={Proc. Interspeech 2021},
37
+ pages={1419--1423},
38
+ doi={10.21437/Interspeech.2021-462}
39
+ }
40
+ '''
41
+
42
+ _HOMEPAGE = "https://github.com/salute-developers/golos"
43
+ _LICENSE = "CC-BY 4.0"
44
+
45
+ _SUBSETS = ["crowd", "farfield"]
46
+
47
+
48
+ class GolosOpusConfig(datasets.BuilderConfig):
49
+ """BuilderConfig for GolosOpus."""
50
+
51
+ def __init__(self, name, **kwargs):
52
+ """BuilderConfig for GolosOpus.
53
+ Args:
54
+ name: Subset of the dataset: crowd or farfield
55
+ **kwargs: keyword arguments forwarded to super.
56
+ """
57
+ super(GolosOpusConfig, self).__init__(name=name, **kwargs)
58
+
59
+
60
+ class GolosOpus(datasets.GeneratorBasedBuilder):
61
+ """GOLOS: Russian Dataset for Speech Research."""
62
+
63
+ VERSION = datasets.Version("1.0.0")
64
+ BUILDER_CONFIGS = [
65
+ GolosOpusConfig(name=subset, description=f"GOLOS OPUS Russian speech dataset - {subset} subset")
66
+ for subset in _SUBSETS
67
+ ]
68
+
69
+ def _info(self):
70
+ features = datasets.Features(
71
+ {
72
+ "id": datasets.Value("string"),
73
+ "path": datasets.Value("string"),
74
+ "text": datasets.Value("string"),
75
+ "duration": datasets.Value("float32"),
76
+ "audio": datasets.Audio(sampling_rate=16000),
77
+ }
78
+ )
79
+
80
+ return datasets.DatasetInfo(
81
+ description=_DESCRIPTION,
82
+ features=features,
83
+ supervised_keys=None,
84
+ homepage=_HOMEPAGE,
85
+ license=_LICENSE,
86
+ citation=_CITATION,
87
+ task_templates=[
88
+ datasets.AutomaticSpeechRecognition(audio_column="audio", transcription_column="text")
89
+ ],
90
+ )
91
+
92
+ def _split_generators(self, dl_manager):
93
+ """Returns SplitGenerators."""
94
+ subset = self.config.name
95
+ return [
96
+ datasets.SplitGenerator(
97
+ name=datasets.Split.TRAIN,
98
+ gen_kwargs={
99
+ "filepath": f"transcript/{subset}/train.tsv",
100
+ "split": "train",
101
+ },
102
+ ),
103
+ datasets.SplitGenerator(
104
+ name=datasets.Split.TEST,
105
+ gen_kwargs={
106
+ "filepath": f"transcript/{subset}/test.tsv",
107
+ "split": "test",
108
+ },
109
+ ),
110
+ ]
111
+
112
+ def _generate_examples(self, filepath, split):
113
+ """Yields examples."""
114
+ data_dir = Path(self.config.data_dir)
115
+ subset = self.config.name
116
+
117
+ # Загружаем информацию о количестве шардов
118
+ with open(data_dir / "n_shards.json", encoding="utf-8") as f:
119
+ n_shards = json.load(f)
120
+
121
+ num_shards = n_shards[subset][split]
122
+
123
+ # Создаем список имен шардов
124
+ audio_shards = [
125
+ data_dir / "audio" / subset / split / f"{split}_{i:05d}.tar"
126
+ for i in range(num_shards)
127
+ ]
128
+
129
+ with open(data_dir / filepath, encoding="utf-8") as f:
130
+ reader = csv.DictReader(f, delimiter="\t")
131
+ for row_id, row in enumerate(reader):
132
+ # Ищем файл в шардах
133
+ sample_id = row["id"]
134
+ file_path = row["path"]
135
+
136
+ # Поиск шарда, в котором находится файл
137
+ import tarfile
138
+ from io import BytesIO
139
+
140
+ # В Common Voice формате нужно искать файл в каждом шарде
141
+ audio_data = None
142
+
143
+ for shard_path in audio_shards:
144
+ try:
145
+ with tarfile.open(shard_path, "r") as tar:
146
+ try:
147
+ member = tar.getmember(file_path)
148
+ f = tar.extractfile(member)
149
+ if f:
150
+ audio_data = {"path": str(shard_path), "bytes": file_path}
151
+ break
152
+ except KeyError:
153
+ continue
154
+ except Exception as e:
155
+ logger.warning(f"Error opening {shard_path}: {e}")
156
+
157
+ if audio_data is None:
158
+ logger.warning(f"Could not find {file_path} in any shard, skipping")
159
+ continue
160
+
161
+ example = {
162
+ "id": row["id"],
163
+ "path": row["path"],
164
+ "text": row["text"],
165
+ "duration": float(row["duration"]) if row["duration"] else 0.0,
166
+ "audio": audio_data,
167
+ }
168
+
169
+ yield row_id, example
n_shards.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crowd": {
3
+ "train": 16,
4
+ "test": 1
5
+ },
6
+ "farfield": {
7
+ "train": 2,
8
+ "test": 1
9
+ }
10
+ }
transcript/crowd/test.tsv ADDED
The diff for this file is too large to render. See raw diff
 
transcript/farfield/test.tsv ADDED
The diff for this file is too large to render. See raw diff