|
import json |
|
import os |
|
import tarfile |
|
import zipfile |
|
import gzip |
|
import subprocess |
|
from os.path import join as p_join |
|
from tqdm import tqdm |
|
from multiprocessing import Pool |
|
from typing import Optional |
|
|
|
import pandas as pd |
|
|
|
from datasets import Dataset, Audio |
|
|
|
|
|
direction = os.getenv("DIRECTION", "enA-jaA") |
|
sides = set(direction.split("-")) |
|
cache_dir_audio = p_join("download", "audio", direction) |
|
cache_dir_feature = p_join("download", "feature", direction) |
|
os.makedirs(cache_dir_audio, exist_ok=True) |
|
os.makedirs(cache_dir_feature, exist_ok=True) |
|
|
|
n_pool = int(os.getenv("N_POOL", 8)) |
|
wget_max_retry = os.getenv("MAX_RETRY", "1") |
|
wget_timeout = os.getenv("TIMEOUT", "20") |
|
line_no_start = int(os.getenv("LINE_NO_START", 0)) |
|
line_no_end = int(os.getenv("LINE_NO_END", 10000)) |
|
|
|
audio_dataset = Dataset.from_dict({"audio": ["path/to/audio_1", "path/to/audio_2", ..., "path/to/audio_n"]}).cast_column("audio", Audio()) |
|
audio_dataset[0]["audio"] |