init
Browse files- download_audio.py +10 -8
download_audio.py
CHANGED
@@ -37,6 +37,7 @@ line_no_end = int(os.getenv("LINE_NO_END", 10000))
|
|
37 |
dataset_id = os.getenv("DATASET_ID", 0)
|
38 |
hf_org = os.getenv("HF_ORG", "asahi417")
|
39 |
hf_dataset = f"seamless-align-{direction}"
|
|
|
40 |
|
41 |
|
42 |
def wget(url: str, output_file: Optional[str] = None):
|
@@ -131,14 +132,15 @@ if __name__ == '__main__':
|
|
131 |
if direction == "enA-jaA":
|
132 |
inputs = [g for g in inputs if len(g["side"].unique()) == 2 and set(g["side"].unique()) == sides]
|
133 |
print(f"removed side != 2: {len(inputs)}")
|
134 |
-
if
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
142 |
|
143 |
def loader(feature: str) -> Dict:
|
144 |
with open(feature) as f_reader:
|
|
|
37 |
dataset_id = os.getenv("DATASET_ID", 0)
|
38 |
hf_org = os.getenv("HF_ORG", "asahi417")
|
39 |
hf_dataset = f"seamless-align-{direction}"
|
40 |
+
skip_wget = bool(int(os.getenv("SKIP_WGET", 0)))
|
41 |
|
42 |
|
43 |
def wget(url: str, output_file: Optional[str] = None):
|
|
|
132 |
if direction == "enA-jaA":
|
133 |
inputs = [g for g in inputs if len(g["side"].unique()) == 2 and set(g["side"].unique()) == sides]
|
134 |
print(f"removed side != 2: {len(inputs)}")
|
135 |
+
if skip_wget:
|
136 |
+
if n_pool == 1:
|
137 |
+
for g in tqdm(inputs, total=len(inputs)):
|
138 |
+
line_no = get_audio(g)
|
139 |
+
else:
|
140 |
+
with Pool(n_pool) as pool:
|
141 |
+
for line_no in pool.imap_unordered(get_audio, inputs):
|
142 |
+
if line_no:
|
143 |
+
print(line_no)
|
144 |
|
145 |
def loader(feature: str) -> Dict:
|
146 |
with open(feature) as f_reader:
|