class_docstr: A tuner layer mixin that provides the common methods and attributes for all tuners.
  
  Args:
      is_plugable (`bool`, *optional*):
          Whether the adapter layer can be plugged to any pytorch module
      active_adapters (Union[List[`str`], `str`], *optional*):
          The name of the active adapter.
class_docstr_tok: ["A","tuner","layer","mixin","that","provides","the","common","methods","and","attributes","for","all","tuners",".","Args",":","is_plugable","(","`","bool","`",",","*","optional","*",")",":","Whether","the","adapter","layer","can","be","plugged","to","any","pytorch","module","active_adapters","(","Union","[","List","[","`","str","`","]",",","`","str","`","]",",","*","optional","*",")",":","The","name","of","the","active","adapter","."]
docstr: Delete an adapter from the layer
  
  This should be called on all adapter layers, or else we will get an inconsistent state.
  
  This method will also set a new active adapter if the deleted adapter was an active adapter. It is important
  that the new adapter is chosen in a deterministic way, so that the same adapter is chosen on all layers.
  
  Args:
      adapter_name (`str`): The name of the adapter to delete
docstr_tok: ["Delete","an","adapter","from","the","layer","This","should","be","called","on","all","adapter","layers",",","or","else","we","will","get","an","inconsistent","state",".","This","method","will","also","set","a","new","active","adapter","if","the","deleted","adapter","was","an","active","adapter",".","It","is","important","that","the","new","adapter","is","chosen","in","a","deterministic","way",",","so","that","the","same","adapter","is","chosen","on","all","layers",".","Args",":","adapter_name","(","`","str","`",")",":","The","name","of","the","adapter","to","delete"]
code: def delete_adapter(self, adapter_name: str) -> None:
      """
      Delete an adapter from the layer
  
      This should be called on all adapter layers, or else we will get an inconsistent state.
  
      This method will also set a new active adapter if the deleted adapter was an active adapter. It is important
      that the new adapter is chosen in a deterministic way, so that the same adapter is chosen on all layers.
  
      Args:
          adapter_name (`str`): The name of the adapter to delete
  
      """
      for attr in self.adapter_layer_names + self.other_param_names:
          if adapter_name in getattr(self, attr):
              del getattr(self, attr)[adapter_name]
  
      if adapter_name in self.active_adapters:
          # choose a new active adapter
          active_adapters = self.active_adapters[:]
          active_adapters.remove(adapter_name)
          if active_adapters:
              self.set_adapter(active_adapters)
          else:
              # no active adapters left, set a new default adapter
              # here we get the list of all adapters existing adapter names and choose the first one
              remaining_adapters = self._all_available_adapter_names()
              if not remaining_adapters:
                  self.set_adapter([])
              else:
                  new_active_adapter = remaining_adapters[0]
                  warnings.warn(
                      f"Adapter {adapter_name} was active which is now deleted. Setting active adapter to "
                      f"{new_active_adapter}."
                  )
                  self.set_adapter(remaining_adapters[0])
  
imports: from __future__ import annotations
  import logging
  import re
  import warnings
  from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from typing import Any, List, Optional, Union
  import torch
  from accelerate.hooks import AlignDevicesHook
  from accelerate.utils import named_module_tensors, offload_state_dict
  from torch import nn
  from transformers import PreTrainedModel
  from transformers.pytorch_utils import Conv1D
  from peft.utils import INCLUDE_LINEAR_LAYERS_SHORTHAND
  from ..config import PeftConfig
  from ..utils import ModulesToSaveWrapper, _get_submodules
label_desc: Use image node_id 12 for calling the BaseTunerLayer obj's underlying member method code with example usage: obj.delete_adapter(adapter_name) without return types