code: def main(cfg: DictConfig) -> None:
      logging.info(
          "\n\n************** Experiment configuration ***********"
      )
      logging.info(f"\n{OmegaConf.to_yaml(cfg)}")
  
      seed_everything(cfg.seed, workers=True)
  
      mode = cfg.mode
      logging.info(f"{mode=}")
  
      model = None
      model_cls = get_class(cfg.model._target_)
      if cfg.model.resume_from_checkpoint is None:
          model = model_cls(cfg=cfg.model)
      else:
          logging.info(
              f"Loading model from checkpoint: {cfg.model.resume_from_checkpoint}"
          )
          model = model_cls.load_from_checkpoint(
              cfg.model.resume_from_checkpoint,
              strict=False,
              cfg=cfg.model,
          )
  
      if mode == "export-mesh":
          mesh = model.mesh(resolution=cfg.mesh_resolution)
          mesh.export(cfg.mesh_fname)
          return
  
      # Prepare callbacks
      callbacks = []
      if cfg.enable_benchmark:
          callbacks.append(instantiate(cfg.benchmark_callback))
  
      # Setup trainer
      trainer = Trainer(callbacks=callbacks, **cfg.trainer)
      exp_manager(trainer, cfg.exp_manager)
  
      # Setup datamodule
      dm = instantiate(cfg.model.data)
  
      if mode == "fit":
          trainer.fit(model, datamodule=dm)
      elif mode == "validate":
          trainer.validate(model, datamodule=dm)
      elif mode == "test":
          trainer.test(model, datamodule=dm)
      else:
          raise ValueError(f"Invalid mode: {mode}")
  
imports: from hydra.utils import get_class, instantiate
  from omegaconf.omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer, seed_everything
  from nemo.core.config import hydra_runner
  from nemo.utils import logging
  from nemo.utils.exp_manager import exp_manager
label_desc: Use image node_id 1 for calling a global function with example usage: main(cfg) without return types