class_docstr: TODO  (@adithyare)
class_docstr_tok: ["TODO","(","@","adithyare",")"]
code: def __init__(self, cfg: DictConfig, trainer: Trainer):
      super().__init__(cfg, trainer)
      # assert cfg.lora_tuning.get('adapter_dim', 0) > 0, "adapter_dim has not been set."
      # assert (
      #     cfg.lora_tuning.adapter_dim % cfg.tensor_model_parallel_size == 0
      # ), "The adapter dim should be divisible by tensor_model_parallel_size."
  
      encoder_adapter_name_keys = [AdapterName.LORA_KQV_ADAPTER]
      decoder_adapter_name_keys = [
          AdapterName.LORA_KQV_ADAPTER,
          AdapterName.LORA_KV_ADAPTER,
          AdapterName.LORA_Q_ADAPTER,
      ]
  
      # add adapter keys to the list -> to update state dict
      self.adapter_name_keys = (
          encoder_adapter_name_keys + decoder_adapter_name_keys
      )
  
      frozen_model_cfg = MegatronT5Model.restore_from(
          cfg.get("language_model_path"),
          trainer=trainer,
          return_config=True,
      )
      for _, layer in self.frozen_model.named_modules():
          if hasattr(layer, "activations_checkpoint_method"):
              layer.activations_checkpoint_method = None  # (@adithyare) adapter learning does not support activations checkpointing atm.
  
      self.frozen_model.freeze()
      logging.info(
          f"Before adding adapters:\n{self.frozen_model.summarize()}"
      )
      encoder = self.frozen_model.enc_dec_model.enc_dec_model.encoder
      decoder = self.frozen_model.enc_dec_model.enc_dec_model.decoder
  
      if encoder:
          encoder_cfg = self._get_component_cfg(
              "encoder", frozen_model_cfg, cfg
          )
          self._add_adapters_to_component(
              encoder, encoder_cfg, encoder_adapter_name_keys
          )
          logging.info(
              f"Adding encoder adapters:\n{self.frozen_model.summarize()}"
          )
  
      if decoder:
          decoder_cfg = self._get_component_cfg(
              "decoder", frozen_model_cfg, cfg
          )
          self._add_adapters_to_component(
              decoder, decoder_cfg, decoder_adapter_name_keys
          )
          logging.info(
              f"Adding decoder adapters:\n{self.frozen_model.summarize()}"
          )
  
imports: import itertools
  from typing import Any
  import torch
  from omegaconf.dictconfig import DictConfig
  from omegaconf.omegaconf import open_dict
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.common.parts.adapter_modules import LinearAdapterConfig
  from nemo.collections.nlp.models.language_modeling.megatron_t5_model import MegatronT5Model
  from nemo.collections.nlp.models.language_modeling.megatron_t5_prompt_learning_model import MegatronT5PromptLearningModel
  from nemo.collections.nlp.models.language_modeling.megatron_t5_sft_model import MegatronT5SFTModel
  from nemo.collections.nlp.modules.common import VirtualPromptStyle
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, InfusedAdapterConfig, LoraKQVAdapterConfig, LoraKVAdapterConfig, LoraQAdapterConfig, MLPInfusedAdapterConfig, ParallelLinearAdapterConfig
  from nemo.collections.nlp.parts.utils_funcs import get_last_rank
  from nemo.core.classes.mixins import adapter_mixins
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 1 to create a new MegatronT5LoraModel object from inherited base classes: MegatronT5BaseAdapterModel with example: obj = MegatronT5LoraModel(cfg, trainer)