docstr: Creates a state_dict using only the adapter parameters.
  This ensures that this wrapper class will only checkpoint the adapter
  weights and not the rest of the base GPT Model.
docstr_tok: ["Creates","a","state_dict","using","only","the","adapter","parameters",".","This","ensures","that","this","wrapper","class","will","only","checkpoint","the","adapter","weights","and","not","the","rest","of","the","base","GPT","Model","."]
code: def state_dict(self, destination=None, prefix=None, keep_vars=False):
      """
      Creates a state_dict using only the adapter parameters.
      This ensures that this wrapper class will only checkpoint the adapter
      weights and not the rest of the base GPT Model.
      """
      state_dict_ = {}
      for name, module in self.frozen_model.named_modules():
          if (
              isinstance(module, adapter_mixins.AdapterModuleMixin)
              and module.is_adapter_available()
          ):
              for adapter_key in self.adapter_name_keys:
                  adapter_module = module.get_adapter_module(
                      adapter_key
                  )
                  if adapter_module:
                      state_adapter_key = ":".join([name, adapter_key])
                      state_dict_[
                          state_adapter_key
                      ] = adapter_module.state_dict()
  
              module.set_enabled_adapters(enabled=True)
      return state_dict_
  
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 6 for calling the MegatronGPTBaseAdapterModel obj's underlying member method code with example usage: obj.state_dict(destination, prefix, keep_vars) and returns: state_dict_