makiour commited on
Commit
e3c5ae4
·
1 Parent(s): ee31cff

dvoice-darija3

Browse files
darija/texts/test.tsv CHANGED
@@ -1,4 +1,4 @@
1
- wav words duration
2
  clipping-bbc22c9d-37c7-4426-8069-e759bd81480f.wav ممكن تعيطي ليها في لبورطابل 2.2
3
  frequency_dropout-735439b0-9a4c-4cfb-9f64-0707c18e8a20.wav صور هديه جميله جدا 3.272666666666667
4
  time_dropout-38132f4d-c788-4e0e-aaf9-e24ad60638ab.wav دراغون بول 2.6006666666666667
 
1
+ path words duration
2
  clipping-bbc22c9d-37c7-4426-8069-e759bd81480f.wav ممكن تعيطي ليها في لبورطابل 2.2
3
  frequency_dropout-735439b0-9a4c-4cfb-9f64-0707c18e8a20.wav صور هديه جميله جدا 3.272666666666667
4
  time_dropout-38132f4d-c788-4e0e-aaf9-e24ad60638ab.wav دراغون بول 2.6006666666666667
darija/texts/train.tsv CHANGED
@@ -1,4 +1,4 @@
1
- wav words duration
2
  clipping-306514b0-d498-41ff-b6ef-333cc36045d8.wav النار سمعت واحد قال لصاحبه رخص يكون عندنا شويه التراب 5.934172335600908
3
  1ddb113f-bbbd-426b-be1f-0e0be670ae4d.wav مرام راكان اسمع والدلائل شيء واحد 4.704580498866213
4
  time_dropout-1e3fcef4-25ec-4548-8075-7868e5b307bb.wav ممكن نكون جاي في الطريق 3.2783900226757368
 
1
+ path words duration
2
  clipping-306514b0-d498-41ff-b6ef-333cc36045d8.wav النار سمعت واحد قال لصاحبه رخص يكون عندنا شويه التراب 5.934172335600908
3
  1ddb113f-bbbd-426b-be1f-0e0be670ae4d.wav مرام راكان اسمع والدلائل شيء واحد 4.704580498866213
4
  time_dropout-1e3fcef4-25ec-4548-8075-7868e5b307bb.wav ممكن نكون جاي في الطريق 3.2783900226757368
dvoice-darija.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import os
3
+ import json
4
+
5
+ import datasets
6
+ from datasets.utils.py_utils import size_str
7
+ from tqdm import tqdm
8
+
9
+ from .languages import LANGUAGES
10
+ from .release_stats import STATS
11
+
12
+
13
+
14
+ # TODO: change "streaming" to "main" after merge!
15
+ _BASE_URL = "https://huggingface.co/datasets/makiour/dvoice-Darija/tree/main/darija/"
16
+
17
+ _AUDIO_URL = _BASE_URL + "wavs/{path}.wav"
18
+
19
+ _TRANSCRIPT_URL = _BASE_URL + "texts/{split}.tsv"
20
+
21
+ _N_SHARDS_URL = _BASE_URL + "n_shards.json"
22
+
23
+
24
+ class CommonVoiceConfig(datasets.BuilderConfig):
25
+ """BuilderConfig for CommonVoice."""
26
+
27
+ def __init__(self, name, version, **kwargs):
28
+ self.language = kwargs.pop("language", None)
29
+ self.release_date = kwargs.pop("release_date", None)
30
+ self.num_clips = kwargs.pop("num_clips", None)
31
+ self.num_speakers = kwargs.pop("num_speakers", None)
32
+ self.validated_hr = kwargs.pop("validated_hr", None)
33
+ self.total_hr = kwargs.pop("total_hr", None)
34
+ self.size_bytes = kwargs.pop("size_bytes", None)
35
+ self.size_human = size_str(self.size_bytes)
36
+ description = (
37
+ "Finetune Whisper with Dvoice Darija Dataset"
38
+ )
39
+ super(CommonVoiceConfig, self).__init__(
40
+ name=name,
41
+ version=datasets.Version(version),
42
+ description=description,
43
+ **kwargs,
44
+ )
45
+
46
+
47
+ class CommonVoice(datasets.GeneratorBasedBuilder):
48
+ DEFAULT_WRITER_BATCH_SIZE = 1000
49
+
50
+ BUILDER_CONFIGS = [
51
+ CommonVoiceConfig(
52
+ name=lang,
53
+ version=STATS["version"],
54
+ language=LANGUAGES[lang],
55
+ release_date=STATS["date"],
56
+ num_clips=lang_stats["clips"],
57
+ num_speakers=lang_stats["users"],
58
+ validated_hr=float(lang_stats["validHrs"]) if lang_stats["validHrs"] else None,
59
+ total_hr=float(lang_stats["totalHrs"]) if lang_stats["totalHrs"] else None,
60
+ size_bytes=int(lang_stats["size"]) if lang_stats["size"] else None,
61
+ )
62
+ for lang, lang_stats in STATS["locales"].items()
63
+ ]
64
+
65
+ def _info(self):
66
+ total_languages = len(STATS["locales"])
67
+ total_valid_hours = STATS["totalValidHrs"]
68
+ description = (
69
+ "Finetune Whisper with Dvoice Darija Dataset"
70
+ )
71
+ features = datasets.Features(
72
+ {
73
+ "path": datasets.Value("string"),
74
+ "audio": datasets.features.Audio(sampling_rate=48_000),
75
+ "words": datasets.Value("string"),
76
+ "duration": datasets.Value("int64"),
77
+ }
78
+ )
79
+
80
+ return datasets.DatasetInfo(
81
+ description=description,
82
+ features=features,
83
+ supervised_keys=None,
84
+ version=self.config.version,
85
+ )