Skip to content
Draft
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def __init__(self, tokenizer: TokenizerSpec, cfg: Dict) -> None:
# Index used for the language-agnostic / auto prompt
self.auto_index = self.prompt_dict.get('auto', 101)

# Fallback language for cuts with no language (e.g. transcribe() temp cuts)
self.default_lang = cfg.get('default_lang', None)

logging.info(
f"LhotseSpeechToTextBpeDatasetWithPromptIndex: "
f"default_prompt_mode={self.default_prompt_mode}, "
Expand Down Expand Up @@ -121,7 +124,7 @@ def _get_prompt_index_for_cut(self, cut) -> int:
mode = self._get_prompt_mode(cut)

if mode == 'langID':
return self._get_prompt_index(cut.supervisions[0].language)
return self._get_prompt_index(cut.supervisions[0].language or self.default_lang)
elif mode == 'auto':
return self.auto_index
elif mode == 'unified':
Expand Down
3 changes: 2 additions & 1 deletion nemo/collections/asr/models/rnnt_bpe_models_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _setup_transcribe_dataloader(self, config: Dict) -> 'torch.utils.data.DataLo
manifest_filepath = os.path.join(config['temp_dir'], 'manifest.json')
batch_size = min(config['batch_size'], len(config['paths2audio_files']))

target_lang = config.get('target_lang', 'en-US')
target_lang = config.get('target_lang', 'auto')

dl_config = {
'manifest_filepath': manifest_filepath,
Expand All @@ -254,6 +254,7 @@ def _setup_transcribe_dataloader(self, config: Dict) -> 'torch.utils.data.DataLo
'num_prompts': self.cfg.model_defaults.get('num_prompts', 128),
'subsampling_factor': self.cfg.get('subsampling_factor', 8),
'default_lang': target_lang,
'default_prompt_mode': 'langID',
'window_stride': self.cfg.preprocessor.get('window_stride', 0.01),
}

Expand Down
Loading