code: def main(cfg):
      logging.info(f"Hydra config: {OmegaConf.to_yaml(cfg)}")
  
      trainer = pl.Trainer(**cfg.trainer)
      exp_manager(trainer, cfg.get("exp_manager", None))
      model = SLUIntentSlotBPEModel(cfg=cfg.model, trainer=trainer)
  
      # Init encoder from pretrained model
      pretrained_encoder_name = cfg.pretrained_encoder.name
      if pretrained_encoder_name is not None:
          if Path(pretrained_encoder_name).is_file():
              logging.info(
                  f"Loading pretrained encoder from local: {pretrained_encoder_name}"
              )
              pretraind_model = ASRModel.restore_from(
                  restore_path=pretrained_encoder_name,
                  map_location=torch.device("cpu"),
              )
              model.encoder.load_state_dict(
                  pretraind_model.encoder.state_dict(), strict=False
              )
              del pretraind_model
          else:
              logging.info(
                  f"Loading pretrained encoder from NGC: {pretrained_encoder_name}"
              )
              if pretrained_encoder_name.startswith("ssl_"):
                  model_cls = SpeechEncDecSelfSupervisedModel
              elif pretrained_encoder_name.startswith("stt_"):
                  model_cls = ASRModel
              else:
                  raise ValueError(
                      f"Unknown pretrained encoder: {pretrained_encoder_name}"
                  )
              pretraind_model = model_cls.from_pretrained(
                  model_name=pretrained_encoder_name,
                  map_location=torch.device("cpu"),
              )
              model.encoder.load_state_dict(
                  pretraind_model.encoder.state_dict(), strict=False
              )
              del pretraind_model
      else:
          logging.info("Not using pretrained encoder.")
  
      if cfg.pretrained_encoder.freeze:
          logging.info("Freezing encoder...")
          model.encoder.freeze()
      else:
          model.encoder.unfreeze()
  
      trainer.fit(model)
  
      if (
          hasattr(cfg.model, "test_ds")
          and cfg.model.test_ds.manifest_filepath is not None
      ):
          if model.prepare_test(trainer):
              trainer.test(model)
  
file_path: NeMo/examples/slu/speech_intent_slot/run_speech_intent_slot_train.py
imports: from pathlib import Path
  import pytorch_lightning
  import torch
  from omegaconf import OmegaConf
  from nemo.collections.asr.models import ASRModel, SLUIntentSlotBPEModel, SpeechEncDecSelfSupervisedModel
  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