class_docstr: A class containing all functions for loading and using adapters weights that are supported in PEFT library. For
  more details about adapters and injecting them in a transformer-based model, check out the PEFT [documentation](https://huggingface.co/docs/peft/index).
  
  Install the latest version of PEFT, and use this mixin to:
  
  - Attach new adapters in the model.
  - Attach multiple adapters and iteratively activate/deactivate them.
  - Activate/deactivate all adapters from the model.
  - Get a list of the active adapters.
docstr: Sets a specific adapter by forcing the model to only use that adapter and disables the other adapters.
  
  If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
  [documentation](https://huggingface.co/docs/peft).
  
  Args:
      adapter_name (Union[str, List[str]])):
          The list of adapters to set or the adapter name in the case of a single adapter.
docstr_tok: ["Sets","a","specific","adapter","by","forcing","the","model","to","only","use","that","adapter","and","disables","the","other","adapters",".","If","you","are","not","familiar","with","adapters","and","PEFT","methods",",","we","invite","you","to","read","more","about","them","on","the","PEFT","[","documentation","]","(","https",":","\/\/huggingface.co\/docs\/peft",")",".","Args",":","adapter_name","(","Union","[","str",",","List","[","str","]","]",")",")",":","The","list","of","adapters","to","set","or","the","adapter","name","in","the","case","of","a","single","adapter","."]
code: def set_adapter(self, adapter_name: Union[str, List[str]]) -> None:
      """
      Sets a specific adapter by forcing the model to only use that adapter and disables the other adapters.
  
      If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
      [documentation](https://huggingface.co/docs/peft).
  
      Args:
          adapter_name (Union[str, List[str]])):
              The list of adapters to set or the adapter name in the case of a single adapter.
      """
      check_peft_version(min_version=MIN_PEFT_VERSION)
  
      if not self._hf_peft_config_loaded:
          raise ValueError(
              "No adapter loaded. Please load an adapter first."
          )
  
      if isinstance(adapter_name, str):
          adapter_name = [adapter_name]
  
      missing = set(adapter_name) - set(self.peft_config)
      if len(missing) > 0:
          raise ValueError(
              f"Following adapter(s) could not be found: {', '.join(missing)}. Make sure you are passing the correct adapter name(s)."
              f" current loaded adapters are: {list(self.peft_config.keys())}"
          )
  
      from peft.tuners.tuners_utils import BaseTunerLayer
  
      _adapters_has_been_set = False
  
      for _, module in self.named_modules():
          if isinstance(module, BaseTunerLayer):
              if hasattr(module, "set_adapter"):
                  module.set_adapter(adapter_name)
              # Previous versions of PEFT does not support multi-adapter inference
              elif (
                  not hasattr(module, "set_adapter")
                  and len(adapter_name) != 1
              ):
                  raise ValueError(
                      "You are trying to set multiple adapters and you have a PEFT version that does not support multi-adapter inference. Please upgrade to the latest version of PEFT."
                      " `pip install -U peft` or `pip install -U git+https://github.com/huggingface/peft.git`"
                  )
              else:
                  module.active_adapter = adapter_name
              _adapters_has_been_set = True
  
      if not _adapters_has_been_set:
          raise ValueError(
              "Did not succeeded in setting the adapter. Please make sure you are using a model that supports adapters."
          )
  
file_path: diffusers/src/diffusers/loaders/peft.py
imports: from typing import List, Union
  from ..utils import MIN_PEFT_VERSION, check_peft_version, is_peft_available
label_desc: Use image node_id 2 for calling the PeftAdapterMixin obj's underlying member method code with example usage: obj.set_adapter(adapter_name) without return types