code: def init_asr_model(model_path: str) -> ASRModel:
      if model_path.endswith(".nemo"):
          logging.info(f"Using local ASR model from {model_path}")
          asr_model = ASRModel.restore_from(restore_path=model_path)
      elif model_path.endswith(".ckpt"):
          asr_model = ASRModel.load_from_checkpoint(
              checkpoint_path=model_path
          )
      else:
          logging.info(f"Using NGC ASR model {model_path}")
          asr_model = ASRModel.from_pretrained(model_name=model_path)
      return asr_model
  
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 6 for calling a global function with example usage: init_asr_model(model_path) and returns: asr_model