code: def __init__(
      self,
      cfg: DictConfig,
      trainer: Trainer = None,
  ):
      self.cfg = cfg
      self.data_prepared = False
  
      self.setup_tokenizer(cfg.tokenizer)
      self.tokenizer.tokenizer.pad_token = (
          self.tokenizer.tokenizer.eos_token
      )
      self.epoch_number = 0
      self.prompt_learning = self.cfg.prompt_learning
      super().__init__(cfg=cfg, trainer=trainer, no_lm_init=True)
  
      if self.cfg.library == "huggingface":
          self.language_model = AutoModelWithLMHead.from_pretrained(
              cfg.language_model.pretrained_model_name
          )
          self.language_model.resize_token_embeddings(
              len(self.tokenizer.tokenizer)
          )
          if self.cfg.language_model.lm_checkpoint:
              self.language_model.load_state_dict(
                  torch.load(self.cfg.language_model.lm_checkpoint)
              )
      elif self.cfg.library == "megatron":
          if self.prompt_learning:
              # removing tokenizer cfg as this triggers tokenizer construction which is not helpful here as we have a separate tokenizer
              new_cfg = copy.copy(cfg)
              del new_cfg.tokenizer
              self.language_model = MegatronGPTPromptLearningModel(
                  new_cfg, trainer
              )
          else:
              self.language_model = MegatronGPTModel.restore_from(
                  cfg.language_model.lm_checkpoint, trainer=trainer
              )
  
imports: import copy
  import os
  from typing import Dict, Optional, Union
  import numpy
  import torch
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from torch.utils.data import DataLoader
  from transformers import AutoModelWithLMHead
  from nemo.collections.nlp.data.dialogue.data_processor.mellon_qa_data_processor import DialogueMellonQADataProcessor
  from nemo.collections.nlp.data.dialogue.data_processor.ms_marco_data_processor import DialogueMSMarcoDataProcessor
  from nemo.collections.nlp.data.dialogue.dataset.dialogue_gpt_generation_dataset import DialogueGPTGenerationDataset
  from nemo.collections.nlp.metrics.dialogue_metrics import DialogueGenerationMetrics
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_model import MegatronGPTModel
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_prompt_learning_model import MegatronGPTPromptLearningModel
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new DialogueGPTGenerationModel object from inherited base classes: NLPModel with example: obj = DialogueGPTGenerationModel(cfg, trainer)