class_docstr: An abstract class providing basic methods for saving and loading weights of a model. Extend this class to build
  custom module weight loaders.
class_docstr_tok: ["An","abstract","class","providing","basic","methods","for","saving","and","loading","weights","of","a","model",".","Extend","this","class","to","build","custom","module","weight","loaders","."]
docstr: Loads the module weights from the given directory. Override this method for additional loading actions. If
  adding the loaded weights to the model passed to the loader class requires adding additional modules, this
  method should also perform the architectural changes to the model.
  
  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
  ) -> Tuple[str, str]:
      """
      Loads the module weights from the given directory. Override this method for additional loading actions. If
      adding the loaded weights to the model passed to the loader class requires adding additional modules, this
      method should also perform the architectural changes to the model.
  
      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, self.weights_helper.weights_name)
      ):
          raise ValueError(
              "Loading path should be a directory where the weights are saved."
          )
  
      # Load config
      config = self.weights_helper.load_weights_config(save_directory)
  
      # Load head weights
      filter_func = self.filter_func(config["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, load_as or config["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 5 for calling the WeightsLoader obj's underlying member method code with example usage: obj.load(save_directory, load_as, loading_info) and returns: save_directory,  unknown