code: def run_offline_inference(cfg: DictConfig) -> DictConfig:
      if "output_filename" not in cfg or not cfg.output_filename:
          if cfg.model_path:
              model_name = Path(cfg.model_path).stem
          else:
              model_name = cfg.pretrained_name
          dataset_name = Path(cfg.test_ds.manifest_filepath).stem
          mode_name = cfg.inference.mode
  
          OmegaConf.set_struct(cfg, True)
          with open_dict(cfg):
              cfg.output_filename = (
                  model_name
                  + "-"
                  + dataset_name
                  + "-"
                  + mode_name
                  + ".json"
              )
  
      with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8") as f:
          OmegaConf.save(cfg, f)
          f.seek(0)  # reset file pointer
          script_path = (
              Path(__file__).parents[2]
              / "examples"
              / "asr"
              / "transcribe_speech.py"
          )
  
          # If need to change other config such as decoding strategy, could either:
          # 1) change TranscriptionConfig on top of the executed scripts such as transcribe_speech.py in examples/asr, or
          # 2) add command as "rnnt_decoding.strategy=greedy_batch " to below script
          subprocess.run(
              f"python {script_path} "
              f"calculate_wer=False "
              f"model_path={cfg.model_path} "
              f"pretrained_name={cfg.pretrained_name} "
              f"dataset_manifest={cfg.test_ds.manifest_filepath} "
              f"output_filename={cfg.output_filename} "
              f"batch_size={cfg.test_ds.batch_size} "
              f"num_workers={cfg.test_ds.num_workers} "
              f"random_seed={cfg.random_seed} "
              f"eval_config_yaml={f.name} "
              f"decoder_type={cfg.inference.decoder_type} ",
              shell=True,
              check=True,
          )
  
      return cfg
  
file_path: NeMo/tools/asr_evaluator/utils.py
imports: import json
  import subprocess
  import tempfile
  from pathlib import Path
  from typing import Tuple
  from omegaconf import DictConfig, OmegaConf, open_dict
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling a global function with example usage: run_offline_inference(cfg) and returns: cfg