class_docstr: Creates AdaLoRA (Adaptive LoRA) model from a pretrained transformers model. Paper:
  https://openreview.net/forum?id=lq62uWRJjiY
  
  Args:
      model ([`transformers.PreTrainedModel`]): The model to be adapted.
      config ([`AdaLoraConfig`]): The configuration of the AdaLora model.
      adapter_name (`str`): The name of the adapter, defaults to `"default"`.
  
  Returns:
      `torch.nn.Module`: The AdaLora model.
  
  Example::
  
      >>> from transformers import AutoModelForSeq2SeqLM, LoraConfig >>> from peft import AdaLoraModel, AdaLoraConfig
      >>> config = AdaLoraConfig(
              peft_type="ADALORA", task_type="SEQ_2_SEQ_LM", r=8, lora_alpha=32, target_modules=["q", "v"],
              lora_dropout=0.01,
          )
      >>> model = AutoModelForSeq2SeqLM.from_pretrained("t5-base") >>> model = AdaLoraModel(model, config, "default")
  
  **Attributes**:
      - **model** ([`transformers.PreTrainedModel`]) -- The model to be adapted.
      - **peft_config** ([`AdaLoraConfig`]): The configuration of the AdaLora model.
class_docstr_tok: ["Creates","AdaLoRA","(","Adaptive","LoRA",")","model","from","a","pretrained","transformers","model",".","Paper",":","https",":","\/\/openreview.net\/forum","?","id=lq62uWRJjiY","Args",":","model","(","[","`","transformers.PreTrainedModel","`","]",")",":","The","model","to","be","adapted",".","config","(","[","`","AdaLoraConfig","`","]",")",":","The","configuration","of","the","AdaLora","model",".","adapter_name","(","`","str","`",")",":","The","name","of","the","adapter",",","defaults","to","`","``","default","''","`",".","Returns",":","`","torch.nn.Module","`",":","The","AdaLora","model",".","Example",":",":",">",">",">","from","transformers","import","AutoModelForSeq2SeqLM",",","LoraConfig",">",">",">","from","peft","import","AdaLoraModel",",","AdaLoraConfig",">",">",">","config","=","AdaLoraConfig","(","peft_type=","''","ADALORA","''",",","task_type=","''","SEQ_2_SEQ_LM","''",",","r=8",",","lora_alpha=32",",","target_modules=","[","``","q","''",",","``","v","''","]",",","lora_dropout=0.01",",",")",">",">",">","model","=","AutoModelForSeq2SeqLM.from_pretrained","(","``","t5-base","''",")",">",">",">","model","=","AdaLoraModel","(","model",",","config",",","``","default","''",")","*","*","Attributes","*","*",":","-","*","*","model","*","*","(","[","`","transformers.PreTrainedModel","`","]",")","--","The","model","to","be","adapted",".","-","*","*","peft_config","*","*","(","[","`","AdaLoraConfig","`","]",")",":","The","configuration","of","the","AdaLora","model","."]
docstr: A helper method to check the config when a new adapter is being added.
  
  Raise a ValueError if there is something wrong with the config or if it conflicts with existing adapters.
docstr_tok: ["A","helper","method","to","check","the","config","when","a","new","adapter","is","being","added",".","Raise","a","ValueError","if","there","is","something","wrong","with","the","config","or","if","it","conflicts","with","existing","adapters","."]
code: def _check_new_adapter_config(self, config: LoraConfig) -> None:
      """
      A helper method to check the config when a new adapter is being added.
  
      Raise a ValueError if there is something wrong with the config or if it conflicts with existing adapters.
  
      """
      super()._check_new_adapter_config(config)
  
      traininable_mode_counter = 0
      for config_ in self.peft_config.values():
          if not config_.inference_mode:
              traininable_mode_counter += 1
  
      if traininable_mode_counter > 1:
          raise ValueError(
              f"{self.__class__.__name__} supports only 1 trainable adapter. "
              "When using multiple adapters, set inference_mode to True for all adapters except the one "
              "you want to train."
          )
  
imports: import warnings
  import torch
  from transformers.pytorch_utils import Conv1D
  from peft.import_utils import is_bnb_4bit_available, is_bnb_available
  from peft.tuners.lora import LoraConfig, LoraModel
  from peft.tuners.tuners_utils import BaseTunerLayer
  from peft.utils import TRANSFORMERS_MODELS_TO_ADALORA_TARGET_MODULES_MAPPING, _freeze_adapter, _get_submodules, get_auto_gptq_quant_linear, get_quantization_config
  from .gptq import SVDQuantLinear
  from .layer import AdaLoraLayer, RankAllocator, SVDLinear
label_desc: Use image node_id 2 for calling the AdaLoraModel obj's underlying member method code with example usage: obj._check_new_adapter_config(config) without return types