docstr: ModelPT override. Optimizer will get self._optimizer_param_groups. 
  Makes two optimizer param groups, one for the frozen model params
  and one for the prompt-table/prompt-encoder params. The learning 
  rate for the frozen model's params will always be zero effectively
  freezing the model's params but still allowing for the needed gradients
  to be passed around in pipeline parallel models. The prompt-encoder 
  and/or prompt table will use the learning rate set by the user. 
docstr_tok: ["ModelPT","override",".","Optimizer","will","get","self._optimizer_param_groups",".","Makes","two","optimizer","param","groups",",","one","for","the","frozen","model","params","and","one","for","the","prompt-table\/prompt-encoder","params",".","The","learning","rate","for","the","frozen","model","'s","params","will","always","be","zero","effectively","freezing","the","model","'s","params","but","still","allowing","for","the","needed","gradients","to","be","passed","around","in","pipeline","parallel","models",".","The","prompt-encoder","and\/or","prompt","table","will","use","the","learning","rate","set","by","the","user","."]
code: def setup_optimizer_param_groups(self):
      """
      ModelPT override. Optimizer will get self._optimizer_param_groups.
      Makes two optimizer param groups, one for the frozen model params
      and one for the prompt-table/prompt-encoder params. The learning
      rate for the frozen model's params will always be zero effectively
      freezing the model's params but still allowing for the needed gradients
      to be passed around in pipeline parallel models. The prompt-encoder
      and/or prompt table will use the learning rate set by the user.
      """
      self.frozen_model.freeze()  # Freeze the entire model
      opt_params = []
      for _, module in self.frozen_model.named_modules():
          if (
              isinstance(module, adapter_mixins.AdapterModuleMixin)
              and module.is_adapter_available()
          ):
              module.set_enabled_adapters(enabled=True)
              module.unfreeze_enabled_adapters()  # selectively unfreeze the adapter modules.
              opt_params += [p for p in module.parameters()]
  
      self._optimizer_param_groups = [{"params": opt_params}]
      logging.info(
          f"Optimizer groups set:\n{self.frozen_model.summarize()}"
      )
  
imports: import itertools
  import os
  import torch
  from omegaconf.dictconfig import DictConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.common.parts.adapter_modules import LinearAdapterConfig
  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.modules.common import VirtualPromptStyle
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, InfusedAdapterConfig, MLPInfusedAdapterConfig, ParallelLinearAdapterConfig
  from nemo.collections.nlp.modules.common.megatron.utils import average_losses_across_data_parallel_group
  from nemo.collections.nlp.parts.nlp_overrides import NLPSaveRestoreConnector
  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 8 for calling the MegatronGPTBaseAdapterModel obj's underlying member method code with example usage: obj.setup_optimizer_param_groups() without return types