| import sys |
| import os |
|
|
| |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "scripts", "speech_recognition"))) |
|
|
| import convert_to_tarred_audio_dataset |
|
|
| def main(): |
| datasets = [ |
| { |
| "manifest_path": "data/common_voice_11_0/ja/train/train_common_voice_11_0_manifest.json", |
| "target_dir": "data/common_voice_11_0/ja/train_tarred_1bk", |
| "num_shards": 1024 |
| }, |
| { |
| "manifest_path": "data/common_voice_11_0/ja/validation/validation_common_voice_11_0_manifest.json", |
| "target_dir": "data/common_voice_11_0/ja/validation_tarred_1bk", |
| "num_shards": 32 |
| }, |
| { |
| "manifest_path": "data/common_voice_11_0/ja/test/test_common_voice_11_0_manifest.json", |
| "target_dir": "data/common_voice_11_0/ja/test_tarred_1bk", |
| "num_shards": 32 |
| } |
| ] |
|
|
| for dataset in datasets: |
| print(f"Processing dataset: {dataset['manifest_path']}") |
| convert_to_tarred_audio_dataset.create_tar_datasets( |
| manifest_path=dataset["manifest_path"], |
| target_dir=dataset["target_dir"], |
| num_shards=dataset["num_shards"], |
| max_duration=15.0, |
| min_duration=1.0, |
| shuffle=True, |
| shuffle_seed=1, |
| sort_in_shards=True, |
| workers=-1 |
| ) |
| print(f"Finished processing dataset: {dataset['manifest_path']}\n") |
|
|
| if __name__ == "__main__": |
| main() |
|
|