code: def _check_and_add_adapter(
      self,
      name,
      module,
      peft_name,
      peft_cfg,
      name_key_to_mcore_mixins=None,
      autocast_dtype=None,
  ):
      if name_key_to_mcore_mixins is not None:
          for mcore_target, mcore_mixin in name_key_to_mcore_mixins[
              peft_name
          ]:
              if name in [
                  mcore_target,
                  f"model.{mcore_target}",
                  f"model.module.{mcore_target}",
              ]:  # simple string match for now
                  swap_mcore_mixin(module, mcore_mixin)
                  if (
                      model_utils.import_class_by_path(
                          peft_cfg._target_
                      )
                      in module.get_accepted_adapter_types()
                  ):
                      module.add_adapter(
                          name=peft_name,
                          cfg=peft_cfg,
                          base_model_cfg=self.cfg,
                          model_parallel_config=self.model_parallel_config,
                      )
                      if autocast_dtype is not None:
                          module.adapter_layer[
                              peft_name
                          ] = module.adapter_layer[peft_name].to(
                              autocast_dtype
                          )
      elif isinstance(module, AdapterModuleMixin):
          if (
              model_utils.import_class_by_path(peft_cfg._target_)
              in module.get_accepted_adapter_types()
          ):
              module.add_adapter(
                  name=peft_name,
                  cfg=peft_cfg,
                  base_model_cfg=self.cfg,
                  model_parallel_config=self.model_parallel_config,
              )
              if autocast_dtype is not None:
                  module.adapter_layer[
                      peft_name
                  ] = module.adapter_layer[peft_name].to(autocast_dtype)
  
file_path: NeMo/nemo/collections/nlp/parts/mixins/multimodal_adapter_mixins.py
imports: import os
  import tempfile
  from typing import List, Optional, Union
  import torch
  from omegaconf import DictConfig, OmegaConf, open_dict
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.collections.nlp.parts.mixins.nlp_adapter_mixins import NLPAdapterModelMixin
  from nemo.collections.nlp.parts.peft_config import PEFT_CONFIG_MAP, CanonicalAdaptersPEFTConfig, LoraPEFTConfig, PEFTConfig, PtuningPEFTConfig
  from nemo.core.classes.mixins.adapter_mixins import AdapterModuleMixin
  from nemo.core.connectors.save_restore_connector import SaveRestoreConnector
  from nemo.utils import logging, model_utils
  from nemo.utils.model_utils import inject_model_parallel_rank
label_desc: Use image node_id 5 for calling the MultimodalAdapterModelMixin obj's underlying member method code with example usage: obj._check_and_add_adapter(name, module, peft_name, peft_cfg, name_key_to_mcore_mixins, autocast_dtype) without return types