class_docstr: TODO  (@adithyare)
class_docstr_tok: ["TODO","(","@","adithyare",")"]
code: def _get_adapter_cfg(self, component_cfg, adapter_key):
      if component_cfg.kv_channels is None:
          assert (
              component_cfg.hidden_size
              % component_cfg.num_attention_heads
              == 0
          ), "hidden_size must be divisible by num_attention_heads if kv_channels is None"
          kv_channels = (
              component_cfg.hidden_size
              // component_cfg.num_attention_heads
          )
      else:
          kv_channels = component_cfg.kv_channels
      projection_size = kv_channels * component_cfg.num_attention_heads
  
      if adapter_key == AdapterName.LORA_KQV_ADAPTER:
          adapter_cfg = LoraKQVAdapterConfig(
              in_features=component_cfg.hidden_size,
              out_features=3 * projection_size,
              dim=component_cfg.lora_tuning.kqv_adapter_dim,
              norm_position="none",
              norm_type="none",
              activation="identity",
              column_init_method=component_cfg.lora_tuning.get(
                  "column_init_method", "normal"
              ),
              row_init_method=component_cfg.lora_tuning.get(
                  "row_init_method", "zero"
              ),
              gather_output=False,
              dropout=0.0,
          )
      elif adapter_key == AdapterName.LORA_KV_ADAPTER:
          adapter_cfg = LoraKVAdapterConfig(
              in_features=component_cfg.hidden_size,
              out_features=2 * projection_size,
              dim=component_cfg.lora_tuning.kv_adapter_dim,
              norm_position="none",
              norm_type="none",
              activation="identity",
              column_init_method=component_cfg.lora_tuning.get(
                  "column_init_method", "normal"
              ),
              row_init_method=component_cfg.lora_tuning.get(
                  "row_init_method", "zero"
              ),
              gather_output=False,
              dropout=0.0,
          )
      elif adapter_key == AdapterName.LORA_Q_ADAPTER:
          adapter_cfg = LoraQAdapterConfig(
              in_features=component_cfg.hidden_size,
              out_features=1 * projection_size,
              dim=component_cfg.lora_tuning.q_adapter_dim,
              norm_position="none",
              norm_type="none",
              activation="identity",
              column_init_method=component_cfg.lora_tuning.get(
                  "column_init_method", "normal"
              ),
              row_init_method=component_cfg.lora_tuning.get(
                  "row_init_method", "zero"
              ),
              gather_output=False,
              dropout=0.0,
          )
      else:
          raise RuntimeError("Unexpected adapter key name..")
  
      return adapter_cfg
  
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 4 for calling the MegatronT5LoraModel obj's underlying member method code with example usage: obj._get_adapter_cfg(component_cfg, adapter_key) and returns: adapter_cfg