Lais Piai
commited on
Commit
·
5d059c4
1
Parent(s):
3a4a96e
automatic
Browse files
NURC-SP_ENTOA_TTS.py
CHANGED
@@ -8,9 +8,13 @@ _PROMPTS_PROSODIC_URLS = {
|
|
8 |
"train": "prosodic/train.csv",
|
9 |
}
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
_PROMPTS_AUTOMATIC_URLS = {
|
12 |
-
"
|
13 |
-
"train": "automatic/train.csv",
|
14 |
}
|
15 |
|
16 |
_ARCHIVES_PROSODIC = {
|
@@ -18,9 +22,13 @@ _ARCHIVES_PROSODIC = {
|
|
18 |
"train": "prosodic/audios.tar.gz",
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
_ARCHIVES_AUTOMATIC = {
|
22 |
-
"
|
23 |
-
"train": "automatic/audios.tar.gz",
|
24 |
}
|
25 |
|
26 |
_PATH_TO_CLIPS = {
|
@@ -28,15 +36,18 @@ _PATH_TO_CLIPS = {
|
|
28 |
"train": "",
|
29 |
}
|
30 |
|
|
|
31 |
class NurcSPConfig(BuilderConfig):
|
32 |
def __init__(self, prompts_type, **kwargs):
|
33 |
super().__init__(**kwargs)
|
34 |
self.prompts_type = prompts_type
|
35 |
|
|
|
36 |
class NurcSPDataset(GeneratorBasedBuilder):
|
37 |
BUILDER_CONFIGS = [
|
38 |
-
NurcSPConfig(name="
|
39 |
NurcSPConfig(name="prosodic", description="Prosodic audio prompts", prompts_type="prosodic"),
|
|
|
40 |
]
|
41 |
|
42 |
def _info(self):
|
@@ -63,7 +74,7 @@ class NurcSPDataset(GeneratorBasedBuilder):
|
|
63 |
}
|
64 |
)
|
65 |
)
|
66 |
-
elif self.config.name == "
|
67 |
return DatasetInfo(
|
68 |
features=datasets.Features(
|
69 |
{
|
@@ -86,11 +97,30 @@ class NurcSPDataset(GeneratorBasedBuilder):
|
|
86 |
}
|
87 |
)
|
88 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
def _split_generators(self, dl_manager):
|
91 |
if self.config.prompts_type == "prosodic":
|
92 |
prompts_urls = _PROMPTS_PROSODIC_URLS
|
93 |
archive_link = _ARCHIVES_PROSODIC
|
|
|
|
|
|
|
94 |
elif self.config.prompts_type == "automatic":
|
95 |
prompts_urls = _PROMPTS_AUTOMATIC_URLS
|
96 |
archive_link = _ARCHIVES_AUTOMATIC
|
@@ -100,26 +130,39 @@ class NurcSPDataset(GeneratorBasedBuilder):
|
|
100 |
prompts_path = dl_manager.download(prompts_urls)
|
101 |
archive = dl_manager.download(archive_link)
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
def _generate_examples(self, prompts_path, path_to_clips, audio_files, split_name):
|
125 |
examples = {}
|
@@ -148,7 +191,7 @@ class NurcSPDataset(GeneratorBasedBuilder):
|
|
148 |
"theme": row['theme'],
|
149 |
}
|
150 |
csv_paths.append(file_path)
|
151 |
-
elif self.config.prompts_type == "
|
152 |
for row in csv_reader:
|
153 |
file_path = Path(row['file_path']).as_posix()
|
154 |
examples[file_path] = {
|
@@ -169,6 +212,19 @@ class NurcSPDataset(GeneratorBasedBuilder):
|
|
169 |
"speaker_id": row['speaker_id'],
|
170 |
}
|
171 |
csv_paths.append(file_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
id_ = 0
|
174 |
for path, f in audio_files:
|
|
|
8 |
"train": "prosodic/train.csv",
|
9 |
}
|
10 |
|
11 |
+
_PROMPTS_AUDIO_CORPUS_URLS = {
|
12 |
+
"dev": "audioCorpus/validation.csv",
|
13 |
+
"train": "audioCorpus/train.csv",
|
14 |
+
}
|
15 |
+
|
16 |
_PROMPTS_AUTOMATIC_URLS = {
|
17 |
+
"train": "automatic/nurc_cm_automatic_all_segments.csv",
|
|
|
18 |
}
|
19 |
|
20 |
_ARCHIVES_PROSODIC = {
|
|
|
22 |
"train": "prosodic/audios.tar.gz",
|
23 |
}
|
24 |
|
25 |
+
_ARCHIVES_AUDIO_CORPUS = {
|
26 |
+
"dev": "audioCorpus/audios.tar.gz",
|
27 |
+
"train": "audioCorpus/audios.tar.gz",
|
28 |
+
}
|
29 |
+
|
30 |
_ARCHIVES_AUTOMATIC = {
|
31 |
+
"train": "automatic/nurc_cm_automatic_segmented_audios.zip",
|
|
|
32 |
}
|
33 |
|
34 |
_PATH_TO_CLIPS = {
|
|
|
36 |
"train": "",
|
37 |
}
|
38 |
|
39 |
+
|
40 |
class NurcSPConfig(BuilderConfig):
|
41 |
def __init__(self, prompts_type, **kwargs):
|
42 |
super().__init__(**kwargs)
|
43 |
self.prompts_type = prompts_type
|
44 |
|
45 |
+
|
46 |
class NurcSPDataset(GeneratorBasedBuilder):
|
47 |
BUILDER_CONFIGS = [
|
48 |
+
NurcSPConfig(name="audioCorpus", description="Audio Corpus audio prompts", prompts_type="audioCorpus"),
|
49 |
NurcSPConfig(name="prosodic", description="Prosodic audio prompts", prompts_type="prosodic"),
|
50 |
+
NurcSPConfig(name="automatic", description="Automatic audio prompts", prompts_type="automatic"),
|
51 |
]
|
52 |
|
53 |
def _info(self):
|
|
|
74 |
}
|
75 |
)
|
76 |
)
|
77 |
+
elif self.config.name == "audioCorpus":
|
78 |
return DatasetInfo(
|
79 |
features=datasets.Features(
|
80 |
{
|
|
|
97 |
}
|
98 |
)
|
99 |
)
|
100 |
+
elif self.config.name == "automatic":
|
101 |
+
return DatasetInfo(
|
102 |
+
features=datasets.Features(
|
103 |
+
{
|
104 |
+
"path": datasets.Value("string"),
|
105 |
+
"name": datasets.Value("string"),
|
106 |
+
"speaker": datasets.Value("string"),
|
107 |
+
"start_time": datasets.Value("string"),
|
108 |
+
"end_time": datasets.Value("string"),
|
109 |
+
"text": datasets.Value("string"),
|
110 |
+
"duration": datasets.Value("string"),
|
111 |
+
"audio": datasets.Audio(sampling_rate=16_000, mono=True),
|
112 |
+
}
|
113 |
+
)
|
114 |
+
)
|
115 |
+
|
116 |
|
117 |
def _split_generators(self, dl_manager):
|
118 |
if self.config.prompts_type == "prosodic":
|
119 |
prompts_urls = _PROMPTS_PROSODIC_URLS
|
120 |
archive_link = _ARCHIVES_PROSODIC
|
121 |
+
elif self.config.prompts_type == "audioCorpus":
|
122 |
+
prompts_urls = _PROMPTS_AUDIO_CORPUS_URLS
|
123 |
+
archive_link = _ARCHIVES_AUDIO_CORPUS
|
124 |
elif self.config.prompts_type == "automatic":
|
125 |
prompts_urls = _PROMPTS_AUTOMATIC_URLS
|
126 |
archive_link = _ARCHIVES_AUTOMATIC
|
|
|
130 |
prompts_path = dl_manager.download(prompts_urls)
|
131 |
archive = dl_manager.download(archive_link)
|
132 |
|
133 |
+
if self.config.prompts_type != "automatic":
|
134 |
+
return [
|
135 |
+
SplitGenerator(
|
136 |
+
name=Split.VALIDATION,
|
137 |
+
gen_kwargs={
|
138 |
+
"prompts_path": prompts_path["dev"],
|
139 |
+
"path_to_clips": _PATH_TO_CLIPS["dev"],
|
140 |
+
"audio_files": dl_manager.iter_archive(archive["dev"]),
|
141 |
+
"split_name": "validation"
|
142 |
+
}
|
143 |
+
),
|
144 |
+
SplitGenerator(
|
145 |
+
name=Split.TRAIN,
|
146 |
+
gen_kwargs={
|
147 |
+
"prompts_path": prompts_path["train"],
|
148 |
+
"path_to_clips": _PATH_TO_CLIPS["train"],
|
149 |
+
"audio_files": dl_manager.iter_archive(archive["train"]),
|
150 |
+
"split_name": "train"
|
151 |
+
}
|
152 |
+
),
|
153 |
+
]
|
154 |
+
else:
|
155 |
+
return [
|
156 |
+
SplitGenerator(
|
157 |
+
name=Split.TRAIN,
|
158 |
+
gen_kwargs={
|
159 |
+
"prompts_path": prompts_path["train"],
|
160 |
+
"path_to_clips": _PATH_TO_CLIPS["train"],
|
161 |
+
"audio_files": dl_manager.iter_archive(archive["train"]),
|
162 |
+
"split_name": "train"
|
163 |
+
}
|
164 |
+
),
|
165 |
+
]
|
166 |
|
167 |
def _generate_examples(self, prompts_path, path_to_clips, audio_files, split_name):
|
168 |
examples = {}
|
|
|
191 |
"theme": row['theme'],
|
192 |
}
|
193 |
csv_paths.append(file_path)
|
194 |
+
elif self.config.prompts_type == "audioCorpus":
|
195 |
for row in csv_reader:
|
196 |
file_path = Path(row['file_path']).as_posix()
|
197 |
examples[file_path] = {
|
|
|
212 |
"speaker_id": row['speaker_id'],
|
213 |
}
|
214 |
csv_paths.append(file_path)
|
215 |
+
elif self.config.prompts_type == "automatic":
|
216 |
+
for row in csv_reader:
|
217 |
+
file_path = Path(row['path']).as_posix()
|
218 |
+
examples[file_path] = {
|
219 |
+
"path": row['path'],
|
220 |
+
"name": row['name'],
|
221 |
+
"speaker": row['speaker'],
|
222 |
+
"start_time": row['start_time'],
|
223 |
+
"end_time": row['end_time'],
|
224 |
+
"text": row['text'],
|
225 |
+
"duration": row['duration'],
|
226 |
+
}
|
227 |
+
csv_paths.append(file_path)
|
228 |
|
229 |
id_ = 0
|
230 |
for path, f in audio_files:
|
{automatic → audioCorpus}/audios.tar.gz
RENAMED
File without changes
|
{automatic → audioCorpus}/train.csv
RENAMED
The diff for this file is too large to render.
See raw diff
|
|
{automatic → audioCorpus}/validation.csv
RENAMED
The diff for this file is too large to render.
See raw diff
|
|
automatic/nurc_cm_automatic_all_segments.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
automatic/nurc_cm_automatic_segmented_audios.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a4564f316a1ac299a8fcc84f2ddd8063c2b8b996f87159f956e1007add1a33a0
|
3 |
+
size 1551683455
|