class_docstr: A class providing methods for saving and loading adapter modules from the Hub, the filesystem or a remote url.
  
  Model classes passed to this loader must implement the `ModelAdaptersMixin` class.
class_docstr_tok: ["A","class","providing","methods","for","saving","and","loading","adapter","modules","from","the","Hub",",","the","filesystem","or","a","remote","url",".","Model","classes","passed","to","this","loader","must","implement","the","`","ModelAdaptersMixin","`","class","."]
docstr: Loads a pre-trained pytorch adapter module from the local file system or a remote location.
  
  Args:
      adapter_name_or_path (str): can be either:
  
          - the identifier of a pre-trained task adapter to be loaded from Adapter Hub
          - a path to a directory containing adapter weights saved using `model.saved_adapter()`
          - a URL pointing to a zip folder containing a saved adapter module
      config (str, optional): The requested configuration of the adapter.
      version (str, optional): The version of the adapter to be loaded.
      model_name (str, optional): The string identifier of the pre-trained model.
      load_as (str, optional): Load the adapter using this name. By default, the name with which the adapter was
       saved will be used.
  
  Returns:
      Tuple[str, str]: A tuple consisting of the local file system directory from which the weights where loaded
      and the name of the loaded weights.
code: def load(
      self,
      adapter_name_or_path,
      config=None,
      version=None,
      model_name=None,
      load_as=None,
      loading_info=None,
      leave_out=None,
      set_active=False,
      **kwargs,
  ):
      """
      Loads a pre-trained pytorch adapter module from the local file system or a remote location.
  
      Args:
          adapter_name_or_path (str): can be either:
  
              - the identifier of a pre-trained task adapter to be loaded from Adapter Hub
              - a path to a directory containing adapter weights saved using `model.saved_adapter()`
              - a URL pointing to a zip folder containing a saved adapter module
          config (str, optional): The requested configuration of the adapter.
          version (str, optional): The version of the adapter to be loaded.
          model_name (str, optional): The string identifier of the pre-trained model.
          load_as (str, optional): Load the adapter using this name. By default, the name with which the adapter was
           saved will be used.
  
      Returns:
          Tuple[str, str]: A tuple consisting of the local file system directory from which the weights where loaded
          and the name of the loaded weights.
      """
      requested_config = AdapterConfig.load(config) if config else None
      # Resolve the weights to be loaded based on the given identifier and the current adapter config
      model_name = self.model.model_name or model_name
      resolved_folder = resolve_adapter_path(
          adapter_name_or_path,
          model_name,
          adapter_config=requested_config,
          version=version,
          **kwargs,
      )
  
      # Load config of adapter
      config = self.weights_helper.load_weights_config(resolved_folder)
      if self.adapter_type and "type" in config:
          assert (
              config["type"] == self.adapter_type
          ), "Loaded adapter has to be a {} adapter.".format(
              self.adapter_type
          )
      elif "type" in config:
          self.adapter_type = config["type"]
      # post-loading drop of layers
      if leave_out is not None:
          if (
              "leave_out" in config["config"]
              and config["config"]["leave_out"] is not None
          ):
              # The conversion to a set and then back to a list removes all duplicates
              leave_out = list(
                  set(leave_out + config["config"]["leave_out"])
              )
          config["config"]["leave_out"] = leave_out
  
      adapter_name = load_as or config["name"]
      # If the adapter is not part of the model, add it
      if adapter_name not in self.model.adapters_config.adapters:
          self.model.add_adapter(
              adapter_name,
              config=config["config"],
              set_active=set_active,
          )
      else:
          logger.warning(
              "Overwriting existing adapter '{}'.".format(adapter_name)
          )
  
      # Load adapter weights
      filter_func = self.filter_func(adapter_name)
      rename_func = self.rename_func(config["name"], adapter_name)
      missing_keys, _ = self.weights_helper.load_weights(
          resolved_folder,
          filter_func,
          rename_func=rename_func,
          loading_info=loading_info,
          in_base_model=True,
      )
      missing_keys = self._fix_legacy_config(adapter_name, missing_keys)
      if isinstance(loading_info, Mapping):
          loading_info["missing_keys"] = missing_keys
  
      return resolved_folder, adapter_name
  
imports: import json
  import logging
  from abc import ABC, abstractmethod
  from os import mkdir
  from os.path import exists, isdir, isfile, join
  from typing import Callable, Mapping, Sequence, Tuple
  import torch
  from .configuration import AdapterConfig, build_full_config
  from .head_utils import STATIC_TO_FLEX_HEAD_MAP, get_head_config_and_rename_list
  from .utils import ACTIVATION_RENAME, ADAPTERFUSION_CONFIG_NAME, ADAPTERFUSION_WEIGHTS_NAME, CONFIG_NAME, HEAD_CONFIG_NAME, HEAD_WEIGHTS_NAME, WEIGHTS_NAME, AdapterType, resolve_adapter_path
label_desc: Use image node_id 9 for calling the AdapterLoader obj's underlying member method code with example usage: obj.load(adapter_name_or_path, config, version, model_name, load_as, loading_info, leave_out, set_active) and returns: resolved_folder,  adapter_name