code: def transcribe_all(filepaths, model_name, use_gpu_if_available=True):
      # instantiate model
      if model_name in MODEL_CACHE:
          model = MODEL_CACHE[model_name]
      else:
          model = initialize_model(model_name)
  
      if torch.cuda.is_available() and use_gpu_if_available:
          model = model.cuda()
  
      # transcribe audio
      logging.info("Begin transcribing audio...")
      try:
          with autocast():
              with torch.no_grad():
                  transcriptions = model.transcribe(
                      filepaths, batch_size=32
                  )
  
      except RuntimeError:
          # Purge the cache to clear some memory
          MODEL_CACHE.clear()
  
          logging.info(
              "Ran out of memory on device - performing inference on CPU for now"
          )
  
          try:
              model = model.cpu()
  
              with torch.no_grad():
                  transcriptions = model.transcribe(
                      filepaths, batch_size=32
                  )
  
          except Exception as e:
              logging.info(
                  f"Exception {e} occured while attemting to transcribe audio. Returning error message"
              )
              return TAG_ERROR_DURING_TRANSCRIPTION
  
      logging.info(f"Finished transcribing {len(filepaths)} files !")
  
      # If RNNT models transcribe, they return a tuple (greedy, beam_scores)
      if type(transcriptions[0]) == list and len(transcriptions) == 2:
          # get greedy transcriptions only
          transcriptions = transcriptions[0]
  
      # Force onto CPU
      model = model.cpu()
      MODEL_CACHE[model_name] = model
  
      return transcriptions
  
file_path: NeMo/tools/asr_webapp/model_api.py
imports: import contextlib
  import glob
  import os
  import torch
  import nemo.collections.asr
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 3 for calling a global function with example usage: transcribe_all(filepaths, model_name, use_gpu_if_available) and returns: transcriptions, TAG_ERROR_DURING_TRANSCRIPTION