class_docstr: This class manages the setup and configuration of adapter modules in a pre-trained model.
class_docstr_tok: ["This","class","manages","the","setup","and","configuration","of","adapter","modules","in","a","pre-trained","model","."]
docstr: Adds a new adapter of the name to the model config.
  
  Args:
      adapter_name (str): The name of the adapter.
      config (Optional[Union[str, dict]], optional): The adapter config. Defaults to None.
docstr_tok: ["Adds","a","new","adapter","of","the","name","to","the","model","config",".","Args",":","adapter_name","(","str",")",":","The","name","of","the","adapter",".","config","(","Optional","[","Union","[","str",",","dict","]","]",",","optional",")",":","The","adapter","config",".","Defaults","to","None","."]
code: def add(
      self, adapter_name: str, config: Optional[Union[str, dict]] = None
  ):
      """
      Adds a new adapter of the name to the model config.
  
      Args:
          adapter_name (str): The name of the adapter.
          config (Optional[Union[str, dict]], optional): The adapter config. Defaults to None.
      """
      if adapter_name in self.adapters:
          raise ValueError(
              f"An adapter with the name '{adapter_name}' has already been added."
          )
      if config is None:
          config = DEFAULT_ADAPTER_CONFIG
      if isinstance(config, str):
          if (
              config not in ADAPTER_CONFIG_MAP
              and config not in self.config_map
          ):
              raise ValueError(
                  f"Invalid adapter config identifier '{config}'."
              )
          config_name = config
      # if it's a dict, compute it's hash and add a new entry to the config map
      elif isinstance(config, Mapping):
          config_name = get_adapter_config_hash(config)
          self.config_map[config_name] = AdapterConfig.load(config)
      else:
          raise ValueError("Invalid adapter config: {}".format(config))
      self.adapters[adapter_name] = config_name
      logger.info(f"Adding adapter '{adapter_name}'.")
  
imports: import copy
  import logging
  from collections.abc import Collection, Mapping
  from typing import List, Optional, Union
  from ..None import __version__
  from ..composition import AdapterCompositionBlock
  from ..utils import get_adapter_config_hash
  from .adapter_config import ADAPTER_CONFIG_MAP, DEFAULT_ADAPTER_CONFIG, AdapterConfig, ConfigUnion
  from .adapter_fusion_config import ADAPTERFUSION_CONFIG_MAP, DEFAULT_ADAPTERFUSION_CONFIG
label_desc: Use image node_id 7 for calling the ModelAdaptersConfig obj's underlying member method code with example usage: obj.add(adapter_name, config) without return types