class_docstr: base class for all mixin based adapter models
docstr: Randomly initialize the peft params and add them to the appropriate modules.
docstr_tok: ["Randomly","initialize","the","peft","params","and","add","them","to","the","appropriate","modules","."]
code: def init_peft_modules(self):
      """
      Randomly initialize the peft params and add them to the appropriate modules.
      """
      assert (
          len(self.peft_name_keys) > 0
      ), "peft_name_keys have not been set no PEFT modules will be added"
      assert not self.mcore_gpt or hasattr(
          self, "name_key_to_mcore_mixins"
      ), f"{self.__class__.__name__} is not supported in megatron core mode yet."
      assert (
          len(self.name_key_to_cfg) > 0
      ), "name_key_to_cfg has not been set no PEFT modules will be added"
      logging.info(f"Before adding PEFT params:\n{self.summarize()}")
      for name, module in self.named_modules():
          if self.mcore_gpt:
              for peft_key in self.peft_name_keys:
                  for (
                      mcore_target,
                      mcore_mixin,
                  ) in self.name_key_to_mcore_mixins[peft_key]:
                      if name in [
                          f"model.{mcore_target}",
                          f"model.module.{mcore_target}",
                      ]:  # simple string match for now
                          swap_mcore_mixin(module, mcore_mixin)
                          peft_cfg = self.name_key_to_cfg[peft_key]
                          if (
                              model_utils.import_class_by_path(
                                  peft_cfg._target_
                              )
                              in module.get_accepted_adapter_types()
                          ):
                              module.add_adapter(
                                  name=peft_key,
                                  cfg=peft_cfg,
                                  base_model_cfg=self.cfg,
                                  model_parallel_config=self.model_parallel_config,
                              )
          else:
              if isinstance(module, adapter_mixins.AdapterModuleMixin):
                  for peft_key in self.peft_name_keys:
                      peft_cfg = self.name_key_to_cfg[peft_key]
                      if (
                          model_utils.import_class_by_path(
                              peft_cfg._target_
                          )
                          in module.get_accepted_adapter_types()
                      ):
                          module.add_adapter(
                              name=peft_key,
                              cfg=peft_cfg,
                              base_model_cfg=self.cfg,
                              model_parallel_config=self.model_parallel_config,
                          )
              if self.megatron_amp_O2:
                  for adapter_name in getattr(
                      module, "adapter_layer", []
                  ):
                      module.adapter_layer[
                          adapter_name
                      ] = module.adapter_layer[adapter_name].to(
                          self.autocast_dtype
                      )
      logging.info(f"After adding PEFT params:\n{self.summarize()}")
      return True
  
imports: from omegaconf.dictconfig import DictConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_sft_model import MegatronGPTSFTModel
  from nemo.collections.nlp.modules.common.megatron.adapters.mcore_mixins import MCoreGPTEmbeddingMixin, MCoreSelfAttentionMixin, MCoreTransformerLayerMixin, swap_mcore_mixin
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, InfusedAdapterConfig, LoraKQVAdapterConfig, LoraKQVAdapterWeightTyingConfig, MLPInfusedAdapterConfig, ParallelLinearAdapterConfig, ParallelLinearAdapterWeightTyingConfig, PromptEncoderAdapterConfig
  from nemo.core.classes.mixins import adapter_mixins
  from nemo.utils import logging, model_utils
  from nemo.utils.decorators import deprecated
label_desc: Use image node_id 3 for calling the MegatronGPTPEFTModel obj's underlying member method code with example usage: obj.init_peft_modules() and returns: True