Skip to content

Commit

Permalink
update hypothesis when passed through cfg (#11366)
Browse files Browse the repository at this point in the history
Signed-off-by: Nithin Rao Koluguri <nithinraok>
Co-authored-by: Nithin Rao Koluguri <nithinraok>
  • Loading branch information
nithinraok authored Nov 21, 2024
1 parent ebc6a88 commit 8ab46ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/asr/transcribe_speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ def main(cfg: TranscriptionConfig) -> Union[TranscriptionConfig, List[Hypothesis

# we will adjust this flag if the model does not support it
compute_langs = cfg.compute_langs
if cfg.timestamps:
cfg.return_hypotheses = True

# Check whether model and decoder type match
if isinstance(asr_model, EncDecCTCModel):
Expand Down
1 change: 1 addition & 0 deletions nemo/collections/asr/models/ctc_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def transcribe(
A list of transcriptions (or raw log probabilities if logprobs is True) in the same order as
paths2audio_files
"""
timestamps = timestamps or override_config.timestamps if override_config is not None else None
if timestamps is not None:
# else retain the decoder state (users can set it using change_decoding_strategy)
if timestamps or (override_config is not None and override_config.timestamps):
Expand Down
2 changes: 1 addition & 1 deletion nemo/collections/asr/models/rnnt_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def transcribe(
* A list of greedy transcript texts / Hypothesis
* An optional list of beam search transcript texts / Hypothesis / NBestHypothesis.
"""

timestamps = timestamps or override_config.timestamps if override_config is not None else None
if timestamps is not None:
if timestamps or (override_config is not None and override_config.timestamps):
logging.info(
Expand Down

0 comments on commit 8ab46ff

Please sign in to comment.