class_docstr: A class designed for extracting word timestamps while the ASR decoding process.
  This class contains a few setups for a slew of NeMo ASR models such as QuartzNet, CitriNet and ConformerCTC models.
class_docstr_tok: ["A","class","designed","for","extracting","word","timestamps","while","the","ASR","decoding","process",".","This","class","contains","a","few","setups","for","a","slew","of","NeMo","ASR","models","such","as","QuartzNet",",","CitriNet","and","ConformerCTC","models","."]
docstr: Initialize the parameters for the given ASR model.
  Currently, the following NGC models are supported:
  
      stt_en_quartznet15x5,
      stt_en_citrinet*,
      stt_en_conformer_ctc*
  
  To assign a proper decoding function for generating timestamp output,
  the name of .nemo file should include the architecture name such as:
  'quartznet', 'conformer', and 'citrinet'.
  
  decoder_delay_in_sec is the amount of delay that is compensated during the word timestamp extraction.
  word_ts_anchor_offset is the reference point for a word and used for matching the word with diarization labels.
  Each ASR model has a different optimal decoder delay and word timestamp anchor offset.
  To obtain an optimized diarization result with ASR, decoder_delay_in_sec and word_ts_anchor_offset
  need to be searched on a development set.
docstr_tok: ["Initialize","the","parameters","for","the","given","ASR","model",".","Currently",",","the","following","NGC","models","are","supported",":","stt_en_quartznet15x5",",","stt_en_citrinet","*",",","stt_en_conformer_ctc","*","To","assign","a","proper","decoding","function","for","generating","timestamp","output",",","the","name","of",".nemo","file","should","include","the","architecture","name","such","as",":","'quartznet","'",",","'conformer","'",",","and","'citrinet","'",".","decoder_delay_in_sec","is","the","amount","of","delay","that","is","compensated","during","the","word","timestamp","extraction",".","word_ts_anchor_offset","is","the","reference","point","for","a","word","and","used","for","matching","the","word","with","diarization","labels",".","Each","ASR","model","has","a","different","optimal","decoder","delay","and","word","timestamp","anchor","offset",".","To","obtain","an","optimized","diarization","result","with","ASR",",","decoder_delay_in_sec","and","word_ts_anchor_offset","need","to","be","searched","on","a","development","set","."]
code: def set_asr_model(self):
      """
      Initialize the parameters for the given ASR model.
      Currently, the following NGC models are supported:
  
          stt_en_quartznet15x5,
          stt_en_citrinet*,
          stt_en_conformer_ctc*
  
      To assign a proper decoding function for generating timestamp output,
      the name of .nemo file should include the architecture name such as:
      'quartznet', 'conformer', and 'citrinet'.
  
      decoder_delay_in_sec is the amount of delay that is compensated during the word timestamp extraction.
      word_ts_anchor_offset is the reference point for a word and used for matching the word with diarization labels.
      Each ASR model has a different optimal decoder delay and word timestamp anchor offset.
      To obtain an optimized diarization result with ASR, decoder_delay_in_sec and word_ts_anchor_offset
      need to be searched on a development set.
      """
      if "quartznet" in self.ASR_model_name.lower():
          self.run_ASR = self.run_ASR_QuartzNet_CTC
          self.encdec_class = EncDecCTCModel
          self.decoder_delay_in_sec = if_none_get_default(
              self.params["decoder_delay_in_sec"], 0.04
          )
          self.word_ts_anchor_offset = if_none_get_default(
              self.params["word_ts_anchor_offset"], 0.12
          )
          self.asr_batch_size = if_none_get_default(
              self.params["asr_batch_size"], 4
          )
          self.model_stride_in_secs = 0.02
  
      elif "conformer" in self.ASR_model_name.lower():
          self.run_ASR = self.run_ASR_BPE_CTC
          self.encdec_class = EncDecCTCModelBPE
          self.decoder_delay_in_sec = if_none_get_default(
              self.params["decoder_delay_in_sec"], 0.08
          )
          self.word_ts_anchor_offset = if_none_get_default(
              self.params["word_ts_anchor_offset"], 0.12
          )
          self.asr_batch_size = if_none_get_default(
              self.params["asr_batch_size"], 16
          )
          self.model_stride_in_secs = 0.04
          # Conformer requires buffered inference and the parameters for buffered processing.
          self.chunk_len_in_sec = 5
          self.total_buffer_in_secs = 25
  
      elif "citrinet" in self.ASR_model_name.lower():
          self.run_ASR = self.run_ASR_CitriNet_CTC
          self.encdec_class = EncDecCTCModelBPE
          self.decoder_delay_in_sec = if_none_get_default(
              self.params["decoder_delay_in_sec"], 0.16
          )
          self.word_ts_anchor_offset = if_none_get_default(
              self.params["word_ts_anchor_offset"], 0.2
          )
          self.asr_batch_size = if_none_get_default(
              self.params["asr_batch_size"], 4
          )
          self.model_stride_in_secs = 0.08
  
      else:
          raise ValueError(
              f"Cannot find the ASR model class for: {self.params['self.ASR_model_name']}"
          )
  
      if self.ASR_model_name.endswith(".nemo"):
          asr_model = self.encdec_class.restore_from(
              restore_path=self.ASR_model_name
          )
      else:
          asr_model = self.encdec_class.from_pretrained(
              model_name=self.ASR_model_name, strict=False
          )
  
      if self.ctc_decoder_params["pretrained_language_model"]:
          if not PYCTCDECODE:
              raise ImportError(
                  "LM for beam search decoding is provided but pyctcdecode is not installed. Install pyctcdecode using PyPI: pip install pyctcdecode"
              )
          self.beam_search_decoder = self.load_LM_for_CTC_decoder(
              asr_model
          )
      else:
          self.beam_search_decoder = None
  
      asr_model.eval()
      return asr_model
  
imports: import copy
  import math
  from typing import Dict, List, Tuple, Type, Union
  import numpy
  import torch
  from omegaconf import OmegaConf
  import nemo.collections.asr
  from nemo.collections.asr.metrics.wer import WER
  from nemo.collections.asr.models import EncDecCTCModel, EncDecCTCModelBPE
  from nemo.collections.asr.parts.submodules.ctc_decoding import CTCBPEDecoding, CTCBPEDecodingConfig, CTCDecoding, CTCDecodingConfig
  from nemo.collections.asr.parts.utils.audio_utils import get_samples
  from nemo.collections.asr.parts.utils.speaker_utils import audio_rttm_map, get_uniqname_from_filepath
  from nemo.collections.asr.parts.utils.streaming_utils import AudioFeatureIterator, FrameBatchASR
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.utils import logging
label_desc: Use image node_id 2 for calling the ASRDecoderTimeStamps obj's underlying member method code with example usage: obj.set_asr_model() and returns: asr_model