class_docstr: Base class for encoder decoder RNNT-based models.
docstr: Uses greedy decoding to transcribe video files. Use this method for debugging and prototyping.
  
  Args:
  
  paths2video_files: (a list) of paths to video files.
  batch_size: (int) batch size to use during inference.         Bigger will result in better throughput performance but would use more memory.
      return_hypotheses: (bool) Either return hypotheses or text
  With hypotheses can do some postprocessing like getting timestamp or rescoring
      num_workers: (int) number of workers for DataLoader
      channel_selector (int | Iterable[int] | str): select a single channel or a subset of channels from multi-channel audio. If set to `'average'`, it performs averaging across channels. Disabled if set to `None`. Defaults to `None`. Uses zero-based indexing.
      augmentor: (DictConfig): Augment audio samples during transcription if augmentor is applied.
  Returns:
      Returns a tuple of 2 items -
      * A list of greedy transcript texts / Hypothesis
      * An optional list of beam search transcript texts / Hypothesis / NBestHypothesis.
docstr_tok: ["Uses","greedy","decoding","to","transcribe","video","files",".","Use","this","method","for","debugging","and","prototyping",".","Args",":","paths2video_files",":","(","a","list",")","of","paths","to","video","files",".","batch_size",":","(","int",")","batch","size","to","use","during","inference",".","Bigger","will","result","in","better","throughput","performance","but","would","use","more","memory",".","return_hypotheses",":","(","bool",")","Either","return","hypotheses","or","text","With","hypotheses","can","do","some","postprocessing","like","getting","timestamp","or","rescoring","num_workers",":","(","int",")","number","of","workers","for","DataLoader","channel_selector","(","int","|","Iterable","[","int","]","|","str",")",":","select","a","single","channel","or","a","subset","of","channels","from","multi-channel","audio",".","If","set","to","`","'average","'","`",",","it","performs","averaging","across","channels",".","Disabled","if","set","to","`","None","`",".","Defaults","to","`","None","`",".","Uses","zero-based","indexing",".","augmentor",":","(","DictConfig",")",":","Augment","audio","samples","during","transcription","if","augmentor","is","applied",".","Returns",":","Returns","a","tuple","of","2","items","-","*","A","list","of","greedy","transcript","texts","\/","Hypothesis","*","An","optional","list","of","beam","search","transcript","texts","\/","Hypothesis","\/","NBestHypothesis","."]
code: def transcribe(
      self,
      paths2video_files: List[str],
      batch_size: int = 4,
      return_hypotheses: bool = False,
      partial_hypothesis: Optional[List["Hypothesis"]] = None,
      num_workers: int = 0,
      channel_selector: Optional[ChannelSelectorType] = None,
      augmentor: DictConfig = None,
  ) -> Tuple[List[str], Optional[List["Hypothesis"]]]:
      """
          Uses greedy decoding to transcribe video files. Use this method for debugging and prototyping.
  
          Args:
  
          paths2video_files: (a list) of paths to video files.
          batch_size: (int) batch size to use during inference. \
          Bigger will result in better throughput performance but would use more memory.
              return_hypotheses: (bool) Either return hypotheses or text
          With hypotheses can do some postprocessing like getting timestamp or rescoring
              num_workers: (int) number of workers for DataLoader
              channel_selector (int | Iterable[int] | str): select a single channel or a subset of channels from multi-channel audio. If set to `'average'`, it performs averaging across channels. Disabled if set to `None`. Defaults to `None`. Uses zero-based indexing.
              augmentor: (DictConfig): Augment audio samples during transcription if augmentor is applied.
          Returns:
              Returns a tuple of 2 items -
              * A list of greedy transcript texts / Hypothesis
              * An optional list of beam search transcript texts / Hypothesis / NBestHypothesis.
          """
      if paths2video_files is None or len(paths2video_files) == 0:
          return {}
      # We will store transcriptions here
      hypotheses = []
      all_hypotheses = []
      # Model's mode and device
      mode = self.training
      device = next(self.parameters()).device
  
      if num_workers is None:
          num_workers = min(batch_size, os.cpu_count() - 1)
  
      try:
          # Switch model to evaluation mode
          self.eval()
          # Freeze the visual front-end, encoder and decoder modules
          self.video_front_end.freeze()
          self.encoder.freeze()
          self.decoder.freeze()
          self.joint.freeze()
          logging_level = logging.get_verbosity()
          logging.set_verbosity(logging.WARNING)
          # Work in tmp directory - will store manifest file there
          with tempfile.TemporaryDirectory() as tmpdir:
              with open(
                  os.path.join(tmpdir, "manifest.json"),
                  "w",
                  encoding="utf-8",
              ) as fp:
                  for video_file in paths2video_files:
                      entry = {
                          "video_filepath": video_file,
                          "duration": 100000,
                          "text": "",
                      }
                      fp.write(json.dumps(entry) + "\n")
  
              config = {
                  "paths2video_files": paths2video_files,
                  "batch_size": batch_size,
                  "temp_dir": tmpdir,
                  "num_workers": num_workers,
                  "channel_selector": channel_selector,
              }
  
              if augmentor:
                  config["augmentor"] = augmentor
  
              temporary_datalayer = self._setup_transcribe_dataloader(
                  config
              )
              for test_batch in tqdm(
                  temporary_datalayer, desc="Transcribing"
              ):
                  encoded, encoded_len = self.forward(
                      input_signal=test_batch[0].to(device),
                      input_signal_length=test_batch[1].to(device),
                  )
                  (
                      best_hyp,
                      all_hyp,
                  ) = self.decoding.rnnt_decoder_predictions_tensor(
                      encoded,
                      encoded_len,
                      return_hypotheses=return_hypotheses,
                      partial_hypotheses=partial_hypothesis,
                  )
  
                  hypotheses += best_hyp
                  if all_hyp is not None:
                      all_hypotheses += all_hyp
                  else:
                      all_hypotheses += best_hyp
  
                  del encoded
                  del test_batch
      finally:
          # set mode back to its original value
          self.train(mode=mode)
  
          logging.set_verbosity(logging_level)
          if mode is True:
              self.video_front_end.unfreeze()
              self.encoder.unfreeze()
              self.decoder.unfreeze()
              self.joint.unfreeze()
      return hypotheses, all_hypotheses
  
imports: import copy
  import json
  import os
  import tempfile
  from math import ceil
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from omegaconf import DictConfig, OmegaConf, open_dict
  from pytorch_lightning import Trainer
  from tqdm.auto import tqdm
  from nemo.collections.asr.data import audio_to_text_dataset
  from nemo.collections.asr.losses.rnnt import RNNTLoss, resolve_rnnt_default_loss_name
  from nemo.collections.asr.metrics.wer import WER
  from nemo.collections.asr.models.asr_model import ASRModel
  from nemo.collections.asr.modules.rnnt import RNNTDecoderJoint
  from nemo.collections.asr.parts.mixins import ASRModuleMixin
  from nemo.collections.asr.parts.submodules.rnnt_decoding import RNNTDecoding, RNNTDecodingConfig
  from nemo.collections.asr.parts.utils.audio_utils import ChannelSelectorType
  from nemo.collections.multimodal.speech_cv.data import video_to_text_dataset
  from nemo.core.classes import Exportable
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.core.classes.mixins import AccessMixin
  from nemo.core.neural_types import AcousticEncodedRepresentation, LengthsType, NeuralType, VideoSignal
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling the VisualEncDecRNNTModel obj's underlying member method code with example usage: obj.transcribe(paths2video_files, batch_size, return_hypotheses, partial_hypothesis, num_workers, channel_selector, augmentor) and returns: hypotheses,  all_hypotheses, dict