Datasets:
| """Join the published alignments to a local audio root and write the jsonl | |
| that pocket-tts training consumes (absolute paths under `path`). | |
| python materialize_manifest.py train/ /data/hifitts2/audio train_aligned.jsonl | |
| """ | |
| import glob | |
| import gzip | |
| import json | |
| import os | |
| import sys | |
| src, audio_root, out = sys.argv[1:4] | |
| files = sorted(glob.glob(os.path.join(src, "*.jsonl.gz"))) if os.path.isdir(src) else [src] | |
| n = missing = 0 | |
| with open(out, "w") as w: | |
| for f in files: | |
| for line in gzip.open(f, "rt"): | |
| d = json.loads(line) | |
| p = os.path.join(audio_root, d.pop("audio_filepath")) | |
| if not os.path.exists(p): | |
| missing += 1 | |
| continue | |
| w.write(json.dumps({"path": p, **d}) + "\n") | |
| n += 1 | |
| print(f"wrote {n} rows to {out} ({missing} rows skipped: audio not on disk)") | |