Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

Update Lhotse's augmentation API usage #5

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions egs/librispeech/asr/simple_v1/prepare.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

import multiprocessing
import os
from concurrent.futures import ProcessPoolExecutor
from pathlib import Path
Expand Down Expand Up @@ -37,14 +38,14 @@
num_jobs = 1
for partition, manifests in librispeech_manifests.items():
print(partition)
with LilcomFilesWriter(f'{output_dir}/feats_{partition}'
) as storage, ProcessPoolExecutor(num_jobs) as ex:
with LilcomFilesWriter(f'{output_dir}/feats_{partition}') as storage, \
ProcessPoolExecutor(num_jobs, mp_context=multiprocessing.get_context("spawn")) as ex:
cut_set = CutSet.from_manifests(
recordings=manifests['recordings'],
supervisions=manifests['supervisions']).compute_and_store_features(
extractor=Fbank(),
storage=storage,
augmenter=augmenter if 'train' in partition else None,
augment_fn=augmenter if 'train' in partition else None,
executor=ex)
librispeech_manifests[partition]['cuts'] = cut_set
cut_set.to_json(output_dir + f'/cuts_{partition}.json.gz')
Expand Down