Datasets:
TenzinGayche
commited on
Commit
•
e4147e9
1
Parent(s):
878fae4
wavpath issue fixed
Browse files- tibetan_voice.py +12 -8
tibetan_voice.py
CHANGED
@@ -97,9 +97,6 @@ class TibetanVoice(datasets.GeneratorBasedBuilder):
|
|
97 |
downloaded_wav = dl_manager.download(_DataUrl)
|
98 |
wavs= dl_manager.iter_archive(downloaded_wav)
|
99 |
downloaded_wav = dl_manager.download_and_extract(_DataUrl)
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
return [
|
104 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"],"wavs":wavs,'wavfilepath':downloaded_wav}),
|
105 |
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["valid"],"wavs":wavs,'wavfilepath':downloaded_wav}),
|
@@ -112,19 +109,25 @@ class TibetanVoice(datasets.GeneratorBasedBuilder):
|
|
112 |
logger.info("generating examples from = %s", filepath)
|
113 |
with open(filepath, encoding="utf-8") as f:
|
114 |
reader = csv.reader(f, delimiter='\t')
|
|
|
115 |
for row in reader:
|
116 |
if len(row) >= 2:
|
117 |
-
path = row[
|
118 |
-
sentence = row[
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
audio_map = {}
|
122 |
for path, f in wavs:
|
123 |
_, filename = os.path.split(path)
|
124 |
-
audio_map[filename] = {"path": wavfilepath
|
125 |
|
126 |
for key, path in enumerate(example_map.keys()):
|
127 |
-
|
128 |
sentence = example_map.get(filename, "")
|
129 |
audio = audio_map.get(filename, {})
|
130 |
example = {
|
@@ -132,6 +135,7 @@ class TibetanVoice(datasets.GeneratorBasedBuilder):
|
|
132 |
"sentence": sentence,
|
133 |
"audio": audio
|
134 |
}
|
|
|
135 |
yield key, example
|
136 |
|
137 |
|
|
|
97 |
downloaded_wav = dl_manager.download(_DataUrl)
|
98 |
wavs= dl_manager.iter_archive(downloaded_wav)
|
99 |
downloaded_wav = dl_manager.download_and_extract(_DataUrl)
|
|
|
|
|
|
|
100 |
return [
|
101 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"],"wavs":wavs,'wavfilepath':downloaded_wav}),
|
102 |
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["valid"],"wavs":wavs,'wavfilepath':downloaded_wav}),
|
|
|
109 |
logger.info("generating examples from = %s", filepath)
|
110 |
with open(filepath, encoding="utf-8") as f:
|
111 |
reader = csv.reader(f, delimiter='\t')
|
112 |
+
|
113 |
for row in reader:
|
114 |
if len(row) >= 2:
|
115 |
+
path = row[1]
|
116 |
+
sentence = row[2]
|
117 |
+
if(str(path)!='path'):
|
118 |
+
example_map[path] = sentence
|
119 |
+
else :
|
120 |
+
continue
|
121 |
+
|
122 |
+
|
123 |
|
124 |
audio_map = {}
|
125 |
for path, f in wavs:
|
126 |
_, filename = os.path.split(path)
|
127 |
+
audio_map[filename] = {"path":os.path.join( wavfilepath,path), "bytes": f.read()}
|
128 |
|
129 |
for key, path in enumerate(example_map.keys()):
|
130 |
+
filename = path
|
131 |
sentence = example_map.get(filename, "")
|
132 |
audio = audio_map.get(filename, {})
|
133 |
example = {
|
|
|
135 |
"sentence": sentence,
|
136 |
"audio": audio
|
137 |
}
|
138 |
+
|
139 |
yield key, example
|
140 |
|
141 |
|