asahi417's picture
init
0a9e1c4
raw
history blame contribute delete
629 Bytes
import os.path
from glob import glob
from os.path import join as p_join
from datasets import Dataset, Audio, DatasetDict
for root_dir in glob(p_join("audio", "*")):
experiment_name = os.path.basename(root_dir)
data_dict = {}
for audio_dir in sorted(glob(p_join(root_dir, "*"))):
data_dict[os.path.basename(audio_dir)] = sorted(glob(p_join(audio_dir, "*")))
dataset = Dataset.from_dict(data_dict)
for key in data_dict:
dataset = dataset.cast_column(key, Audio())
DatasetDict({"test": dataset}).push_to_hub(
"asahi417/experiment-audio-tokenizer", config_name=experiment_name
)