code: def main(cfg: DictConfig) -> None:
      logging.debug(f"Config Params: {OmegaConf.to_yaml(cfg)}")
  
      if cfg.pretrained_model is None:
          raise ValueError("A pre-trained model should be provided.")
      _, model = instantiate_model_and_trainer(cfg, ITN_MODEL, False)
  
      text_file = cfg.inference.from_file
      logging.info(f"Running inference on {text_file}...")
      if not os.path.exists(text_file):
          raise ValueError(f"{text_file} not found.")
  
      with open(text_file, "r", encoding="utf-8") as f:
          lines = f.readlines()
  
      batch_size = cfg.inference.get("batch_size", 8)
  
      batch, all_preds = [], []
      for i, line in enumerate(lines):
          s = spoken_preprocessing(
              line
          )  # this is the same input transformation as in corpus preparation
          batch.append(s.strip())
          if len(batch) == batch_size or i == len(lines) - 1:
              outputs = model._infer(batch)
              for x in outputs:
                  all_preds.append(x)
              batch = []
      if len(all_preds) != len(lines):
          raise ValueError(
              "number of input lines and predictions is different: predictions="
              + str(len(all_preds))
              + "; lines="
              + str(len(lines))
          )
      out_file = cfg.inference.out_file
      with open(f"{out_file}", "w", encoding="utf-8") as f_out:
          f_out.write("\n".join(all_preds))
      logging.info(f"Predictions saved to {out_file}.")
  
imports: import os
  from helpers import ITN_MODEL, instantiate_model_and_trainer
  from omegaconf import DictConfig, OmegaConf
  from nemo.collections.nlp.data.text_normalization_as_tagging.utils import spoken_preprocessing
  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