code: def main(cfg: DictConfig) -> None:
      logging.info(f"Config:\n {OmegaConf.to_yaml(cfg)}")
      trainer = pl.Trainer(
          devices=cfg.trainer.devices,
          accelerator=cfg.trainer.accelerator,
      )
      nmt_model = Text2SparqlModel.restore_from(
          restore_path=cfg.model.nemo_path
      )
      nmt_model.setup_test_data(cfg.model.test_ds)
      results = trainer.test(nmt_model)
  
      with open(cfg.model.test_ds.filepath, "r", encoding="utf-8") as f:
          lines = f.readlines()
  
      lines[0] = lines[0].strip() + f"\tpredictions\n"
      for i, res in enumerate(results[0]["texts"]):
          lines[i + 1] = lines[i + 1].strip() + f"\t{res}\n"
  
      savepath = os.path.join(
          cfg.exp_manager.exp_dir,
          os.path.basename(cfg.model.test_ds.filepath),
      )
      with open(savepath, "w", encoding="utf-8") as f:
          f.writelines(lines)
          logging.info(f"Predictions saved to {savepath}")
  
imports: import os
  import pytorch_lightning
  from omegaconf import DictConfig, OmegaConf
  from nemo.collections.nlp.models.text2sparql import Text2SparqlModel
  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