czyhust's picture
Add files using upload-large-folder tool
bed2cee verified
Raw
History Blame Contribute Delete
1.26 kB
#!/usr/bin/env python3
"""Generate Lhotse CutSet files from recordings + supervisions manifests."""
from pathlib import Path
from lhotse import CutSet, load_manifest
# Configuration
manifest_dir = Path("/F00120240032/librispeech/corpus_librispeech/corpus/lhotse_format_manifests")
prefix = "librispeech"
# Define splits (adjust as needed)
splits = [
"train-clean-100",
"train-clean-360",
"train-other-500",
"dev-clean",
"dev-other",
"test-clean",
"test-other",
]
for split in splits:
rec_path = manifest_dir / f"{prefix}_recordings_{split}.jsonl.gz"
sup_path = manifest_dir / f"{prefix}_supervisions_{split}.jsonl.gz"
cut_path = manifest_dir / f"{prefix}_cutset_{split}.jsonl.gz"
if not rec_path.exists():
print(f"[SKIP] Recording manifest not found: {rec_path}")
continue
if not sup_path.exists():
print(f"[SKIP] Supervision manifest not found: {sup_path}")
continue
print(f"Processing {split}...")
cuts = CutSet.from_manifests(
recordings=load_manifest(rec_path),
supervisions=load_manifest(sup_path)
)
cuts.to_file(cut_path)
print(f" Saved: {cut_path} ({len(cuts)} cuts)")
print("\nDone! Generated cutset files for FastMSS.")