class_docstr: A class providing methods for saving and loading AdapterFusion modules from the file system.
class_docstr_tok: ["A","class","providing","methods","for","saving","and","loading","AdapterFusion","modules","from","the","file","system","."]
docstr: Loads a AdapterFusion module from the given directory.
  
  Args:
      save_directory (str): The directory from where to load the weights.
      load_as (str, optional): Load the weights with this name. Defaults to None.
  
  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, save_directory, load_as=None, loading_info=None, **kwargs
  ):
      """
      Loads a AdapterFusion module from the given directory.
  
      Args:
          save_directory (str): The directory from where to load the weights.
          load_as (str, optional): Load the weights with this name. Defaults to None.
  
      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.
      """
      if not exists(join(save_directory, ADAPTERFUSION_WEIGHTS_NAME)):
          if self.error_on_missing:
              raise ValueError(
                  "Loading path should be a directory where AdapterFusion is saved."
              )
          else:
              logger.debug(
                  "No matching adapter fusion found in '{}'".format(
                      save_directory
                  )
              )
              return None, None
  
      config = self.weights_helper.load_weights_config(save_directory)
  
      adapter_fusion_name = load_as or config["name"]
      if adapter_fusion_name not in self.model.adapters_config.fusions:
          self.model.add_adapter_fusion(
              adapter_fusion_name,
              config["config"],
              overwrite_ok=True,
              set_active=kwargs.pop("set_active", True),
          )
      else:
          logger.warning(
              "Overwriting existing adapter fusion module '{}'".format(
                  adapter_fusion_name
              )
          )
  
      # Load AdapterFusion weights
      filter_func = self.filter_func(adapter_fusion_name)
      if load_as:
          rename_func = self.rename_func(config["name"], load_as)
      else:
          rename_func = None
      self.weights_helper.load_weights(
          save_directory,
          filter_func,
          rename_func=rename_func,
          loading_info=loading_info,
      )
  
      return save_directory, adapter_fusion_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 7 for calling the AdapterFusionLoader obj's underlying member method code with example usage: obj.load(save_directory, load_as, loading_info) and returns: save_directory,  adapter_fusion_name, None,  None