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: Extracts the weights of a given adapter from the model and returns them as a state dict.
  
  Args:
      name (str): The name of the adapter to be saved.
  
  Returns:
      Tuple[dict, dict]: A tuple consisting of the state dict containing the adapter weights and the adapter
      configuration.
code: def save_to_state_dict(self, name: str):
      """
      Extracts the weights of a given adapter from the model and returns them as a state dict.
  
      Args:
          name (str): The name of the adapter to be saved.
  
      Returns:
          Tuple[dict, dict]: A tuple consisting of the state dict containing the adapter weights and the adapter
          configuration.
      """
      if name not in self.model.adapters_config.adapters:
          raise ValueError(
              "No adapter of this type with the given name is part of this model."
          )
  
      adapter_config = self.model.adapters_config.get(name)
  
      config_dict = build_full_config(
          adapter_config,
          self.model.config,
          model_name=self.model.model_name,
          name=name,
          model_class=self.model.__class__.__name__,
      )
  
      # Save adapter weights
      filter_func = self.filter_func(config_dict["name"])
      state_dict = self.weights_helper.state_dict(filter_func)
  
      return state_dict, config_dict
  
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 6 for calling the AdapterLoader obj's underlying member method code with example usage: obj.save_to_state_dict(name) and returns: state_dict,  config_dict