class_docstr: Generic Adapter Mixin that can augment any torch.nn.Module with Adapter module support.
  
  This mixin class adds a hierarchical way to add any type of Adapter modules to a pre-existing module.
  Since Models are inherently also nn.Module, this mixin can be attached to any Model or Module.
  This mixin class adds several utility methods which are utilized or overridden as necessary.
  
  An Adapter module is any Pytorch nn.Module that possess a few properties :
  
      -   It's input and output dimension are the same, while the hidden dimension need not be the same.
      -   The final layer of the Adapter module is zero-initialized, so that the residual connection to the adapter
              yields the original output.
  
  This mixin adds the following instance variables to the class this inherits it:
  
      -   `adapter_layer`: A torch.nn.ModuleDict(), whose keys are the names of the adapter (globally unique),
              and values are the Adapter nn.Module().
      -   `adapter_cfg`: A OmegaConf DictConfig object that holds the config of the adapters that are initialized.
      -   `adapter_name`: A str resolved name which is unique key globally, but more than one modules may share
              this name.
      -   `adapter_global_cfg_key`: A str representing a key in the model config that can be provided by the user.
              The value resolves to `global_cfg`, and can be overridden via `model.cfg.adapters.global_cfg.*`.
      -   `adapter_metadata_cfg_key`: A str representing a key in the model config that is used to preserve the
              metadata of the adapter config.
  
  .. note::
  
      This module is **not** responsible for maintaining its config. Subclasses must ensure config is updated
      or preserved as needed. It is the responsibility of the subclasses to propagate the most up to date config to
      lower layers.
class_docstr_tok: ["Generic","Adapter","Mixin","that","can","augment","any","torch.nn.Module","with","Adapter","module","support",".","This","mixin","class","adds","a","hierarchical","way","to","add","any","type","of","Adapter","modules","to","a","pre-existing","module",".","Since","Models","are","inherently","also","nn.Module",",","this","mixin","can","be","attached","to","any","Model","or","Module",".","This","mixin","class","adds","several","utility","methods","which","are","utilized","or","overridden","as","necessary",".","An","Adapter","module","is","any","Pytorch","nn.Module","that","possess","a","few","properties",":","-","It","'s","input","and","output","dimension","are","the","same",",","while","the","hidden","dimension","need","not","be","the","same",".","-","The","final","layer","of","the","Adapter","module","is","zero-initialized",",","so","that","the","residual","connection","to","the","adapter","yields","the","original","output",".","This","mixin","adds","the","following","instance","variables","to","the","class","this","inherits","it",":","-","`","adapter_layer","`",":","A","torch.nn.ModuleDict","(",")",",","whose","keys","are","the","names","of","the","adapter","(","globally","unique",")",",","and","values","are","the","Adapter","nn.Module","(",")",".","-","`","adapter_cfg","`",":","A","OmegaConf","DictConfig","object","that","holds","the","config","of","the","adapters","that","are","initialized",".","-","`","adapter_name","`",":","A","str","resolved","name","which","is","unique","key","globally",",","but","more","than","one","modules","may","share","this","name",".","-","`","adapter_global_cfg_key","`",":","A","str","representing","a","key","in","the","model","config","that","can","be","provided","by","the","user",".","The","value","resolves","to","`","global_cfg","`",",","and","can","be","overridden","via","`","model.cfg.adapters.global_cfg.","*","`",".","-","`","adapter_metadata_cfg_key","`",":","A","str","representing","a","key","in","the","model","config","that","is","used","to","preserve","the","metadata","of","the","adapter","config",".","..","note",":",":","This","module","is","*","*","not","*","*","responsible","for","maintaining","its","config",".","Subclasses","must","ensure","config","is","updated","or","preserved","as","needed",".","It","is","the","responsibility","of","the","subclasses","to","propagate","the","most","up","to","date","config","to","lower","layers","."]
docstr: Returns a list of all enabled adapters names. The names will always be the resolved names, without
  module info.
  
  Returns:
      A list of str names of each enabled adapter names(s).
docstr_tok: ["Returns","a","list","of","all","enabled","adapters","names",".","The","names","will","always","be","the","resolved","names",",","without","module","info",".","Returns",":","A","list","of","str","names","of","each","enabled","adapter","names","(","s",")","."]
code: def get_enabled_adapters(self) -> List[str]:
      """
      Returns a list of all enabled adapters names. The names will always be the resolved names, without
      module info.
  
      Returns:
          A list of str names of each enabled adapter names(s).
      """
      if not self.is_adapter_available():
          return []
  
      # populate set of available modules (by name)
      available_module_names = set([])
      if hasattr(self, "adapter_layer"):
          available_module_names.update(list(self.adapter_layer.keys()))
  
      # populate list of allowed adapter classes
      adapter_types = self.get_accepted_adapter_types()
  
      enabled_adapters = []
      for name, config in self.adapter_cfg.items():
          # Skip the global adapter config
          if name == self.adapter_global_cfg_key:
              continue
  
          # If name is in the current available modules, and it is enabled in the config
          if (
              name in available_module_names
              and self.adapter_cfg[name]["enabled"]
          ):
              # Check if type is supported (if available) and is an enabled adapter
              if len(adapter_types) > 0:
                  module = self.get_adapter_module(name)
  
                  for adapter_type in adapter_types:
                      if isinstance(module, adapter_type):
                          enabled_adapters.append(name)
                          break
  
              else:
                  # Ignore type checking and fall back to adding all enabled adapters
                  enabled_adapters.append(name)
  
      return enabled_adapters
  
imports: import inspect
  from abc import ABC
  from dataclasses import dataclass, is_dataclass
  from typing import List, Optional, Set, Tuple, Union
  import torch
  import torch.nn
  from hydra.utils import instantiate
  from omegaconf import DictConfig, OmegaConf, open_dict
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 4 for calling the AdapterModuleMixin obj's underlying member method code with example usage: obj.get_enabled_adapters() and returns: enabled_adapters, list