From 70d8cc191b322d25fdb9428396c21a66d19f3ffb Mon Sep 17 00:00:00 2001 From: anteju <108555623+anteju@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:33:55 -0700 Subject: [PATCH] Fixed sampler override and audio_key in prepare_audio_data (#10980) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ante Jukić --- examples/audio/process_audio.py | 4 ++-- nemo/collections/asr/parts/utils/transcribe_utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/audio/process_audio.py b/examples/audio/process_audio.py index e28fb4e69627..ec88bda34954 100644 --- a/examples/audio/process_audio.py +++ b/examples/audio/process_audio.py @@ -159,8 +159,8 @@ def main(cfg: ProcessConfig) -> ProcessConfig: audio_to_audio_model.set_trainer(trainer) audio_to_audio_model = audio_to_audio_model.eval() - # override sampler - if cfg.sampler is not None: + # override sampler if necessary + if cfg.sampler: logging.info('Overriding sampler with %s', cfg.sampler) if hasattr(audio_to_audio_model, 'sampler'): diff --git a/nemo/collections/asr/parts/utils/transcribe_utils.py b/nemo/collections/asr/parts/utils/transcribe_utils.py index c1e712c44aeb..0d4f4c895bcf 100644 --- a/nemo/collections/asr/parts/utils/transcribe_utils.py +++ b/nemo/collections/asr/parts/utils/transcribe_utils.py @@ -314,7 +314,7 @@ def prepare_audio_data(cfg: DictConfig) -> Tuple[List[str], bool]: with NamedTemporaryFile(mode='w', suffix='.json', delete=False) as f: for item in read_and_maybe_sort_manifest(cfg.dataset_manifest, try_sort=cfg.presort_manifest): audio_file = get_full_path(audio_file=item[audio_key], manifest_file=cfg.dataset_manifest) - item[audio_key] = audio_file + item['audio_filepath'] = audio_file filepaths.append(audio_file) f.write(json.dumps(item) + "\n") sorted_manifest_path = f.name