class_docstr: Creates a Infused Adapter by Inhibiting and Amplifying Inner Activations ((IA)^3) model from a pretrained
  transformers model. The method is described in detail in https://arxiv.org/abs/2205.05638
  
  Args:
      model ([`~transformers.PreTrainedModel`]): The model to be adapted.
      config ([`IA3Config`]): The configuration of the (IA)^3 model.
      adapter_name (`str`): The name of the adapter, defaults to `"default"`.
  
  Returns:
      `torch.nn.Module`: The (IA)^3 model.
  
  Example:
  
      ```py
      >>> from transformers import AutoModelForSeq2SeqLM, ia3Config
      >>> from peft import IA3Model, IA3Config
  
      >>> config = IA3Config(
      ...     peft_type="IA3",
      ...     task_type="SEQ_2_SEQ_LM",
      ...     target_modules=["k", "v", "w0"],
      ...     feedforward_modules=["w0"],
      ... )
  
      >>> model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
      >>> ia3_model = IA3Model(config, model)
      ```
  
  **Attributes**:
      - **model** ([`~transformers.PreTrainedModel`]) -- The model to be adapted.
      - **peft_config** ([`ia3Config`]): The configuration of the (IA)^3 model.
class_docstr_tok: ["Creates","a","Infused","Adapter","by","Inhibiting","and","Amplifying","Inner","Activations","(","(","IA",")","^3",")","model","from","a","pretrained","transformers","model",".","The","method","is","described","in","detail","in","https",":","\/\/arxiv.org\/abs\/2205.05638","Args",":","model","(","[","`","~transformers.PreTrainedModel","`","]",")",":","The","model","to","be","adapted",".","config","(","[","`","IA3Config","`","]",")",":","The","configuration","of","the","(","IA",")","^3","model",".","adapter_name","(","`","str","`",")",":","The","name","of","the","adapter",",","defaults","to","`","``","default","''","`",".","Returns",":","`","torch.nn.Module","`",":","The","(","IA",")","^3","model",".","Example",":","``","`","py",">",">",">","from","transformers","import","AutoModelForSeq2SeqLM",",","ia3Config",">",">",">","from","peft","import","IA3Model",",","IA3Config",">",">",">","config","=","IA3Config","(","...","peft_type=","''","IA3","''",",","...","task_type=","''","SEQ_2_SEQ_LM","''",",","...","target_modules=","[","``","k","''",",","``","v","''",",","``","w0","''","]",",","...","feedforward_modules=","[","``","w0","''","]",",","...",")",">",">",">","model","=","AutoModelForSeq2SeqLM.from_pretrained","(","``","t5-base","''",")",">",">",">","ia3_model","=","IA3Model","(","config",",","model",")","``","`","*","*","Attributes","*","*",":","-","*","*","model","*","*","(","[","`","~transformers.PreTrainedModel","`","]",")","--","The","model","to","be","adapted",".","-","*","*","peft_config","*","*","(","[","`","ia3Config","`","]",")",":","The","configuration","of","the","(","IA",")","^3","model","."]
docstr: Set the active adapter(s).
  
  Args:
      adapter_name (`str` or `list[str]`): Name of the adapter(s) to be activated.
docstr_tok: ["Set","the","active","adapter","(","s",")",".","Args",":","adapter_name","(","`","str","`","or","`","list","[","str","]","`",")",":","Name","of","the","adapter","(","s",")","to","be","activated","."]
code: def set_adapter(self, adapter_name: str | list[str]) -> None:
      """Set the active adapter(s).
  
      Args:
          adapter_name (`str` or `list[str]`): Name of the adapter(s) to be activated.
      """
      for module in self.model.modules():
          if isinstance(module, IA3Layer):
              if module.merged:
                  warnings.warn(
                      "Adapter cannot be set when the model is merged. Unmerging the model first."
                  )
                  module.unmerge()
              module.set_adapter(adapter_name)
  
imports: from __future__ import annotations
  import re
  import warnings
  from dataclasses import asdict
  from enum import Enum
  from typing import List, Optional
  import torch
  from torch import nn
  from transformers.pytorch_utils import Conv1D
  from peft.import_utils import is_bnb_4bit_available, is_bnb_available
  from peft.tuners.tuners_utils import BaseTuner, BaseTunerLayer, check_target_module_exists
  from peft.utils import TRANSFORMERS_MODELS_TO_IA3_FEEDFORWARD_MODULES_MAPPING, TRANSFORMERS_MODELS_TO_IA3_TARGET_MODULES_MAPPING, ModulesToSaveWrapper, _get_submodules
  from .layer import Conv2d, IA3Layer, Linear
label_desc: Use image node_id 13 for calling the IA3Model obj's underlying member method code with example usage: obj.set_adapter(adapter_name) without return types