code: def main(cfg):
      if is_dataclass(cfg):
          cfg = OmegaConf.structured(cfg)
  
      if cfg.output_dir is None:
          cfg.output_dir = "./outputs"
      output_dir = Path(cfg.output_dir)
      output_dir.mkdir(parents=True, exist_ok=True)
  
      logging.info(f"Hydra config: {OmegaConf.to_yaml(cfg)}")
  
      # setup profiling, note that profiling will significantly increast the total runtime
      if cfg.profiling:
          logging.info("Profiling enabled")
          profile_fn = profile
          record_fn = record_function
      else:
          logging.info("Profiling disabled")
  
          @contextlib.contextmanager
          def profile_fn(*args, **kwargs):
              yield
  
          @contextlib.contextmanager
          def record_fn(*args, **kwargs):
              yield
  
      input_manifest_file = prepare_inference_manifest(cfg)
  
      if cfg.manifest_filepath is None:
          cfg.manifest_filepath = str(input_manifest_file)
  
      with profile_fn(
          activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA],
          record_shapes=True,
          profile_memory=True,
      ) as prof:
          input_manifest_file = extract_audio_features(
              input_manifest_file, cfg, record_fn
          )
  
          if cfg.vad_model is not None:
              logging.info(f"Running VAD with model: {cfg.vad_model}")
              input_manifest_file = run_vad_inference(
                  input_manifest_file, cfg, record_fn
              )
  
          if cfg.asr_model is not None:
              logging.info(f"Running ASR with model: {cfg.asr_model}")
              run_asr_inference(input_manifest_file, cfg, record_fn)
  
      if cfg.profiling:
          print(
              "--------------------------------------------------------------------\n"
          )
          print(
              prof.key_averages().table(
                  sort_by="cuda_time_total", row_limit=15
              )
          )
          print(
              "--------------------------------------------------------------------\n"
          )
      logging.info("Done.")
  
imports: import contextlib
  import json
  import os
  import time
  from dataclasses import dataclass, is_dataclass
  from pathlib import Path
  from typing import Callable, Optional
  import torch
  import yaml
  from omegaconf import DictConfig, OmegaConf
  from torch.profiler import ProfilerActivity, profile, record_function
  from tqdm import tqdm
  from nemo.collections.asr.data import feature_to_text_dataset
  from nemo.collections.asr.metrics.wer import word_error_rate
  from nemo.collections.asr.models import ASRModel, EncDecClassificationModel
  from nemo.collections.asr.parts.submodules import CTCDecodingConfig
  from nemo.collections.asr.parts.submodules.rnnt_decoding import RNNTDecodingConfig
  from nemo.collections.asr.parts.utils.manifest_utils import read_manifest, write_manifest
  from nemo.collections.asr.parts.utils.vad_utils import generate_overlap_vad_seq, generate_vad_segment_table, get_vad_stream_status, init_frame_vad_model, init_vad_model
  from nemo.core.config import hydra_runner
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: main(cfg) without return types