class_docstr: A large testing suite for testing common functionality of the PEFT models.
  
  Attributes:
      torch_device (`torch.device`):
          The device on which the tests will be run.
      transformers_class (`transformers.PreTrainedModel`):
          The transformers class that is being tested.
class_docstr_tok: ["A","large","testing","suite","for","testing","common","functionality","of","the","PEFT","models",".","Attributes",":","torch_device","(","`","torch.device","`",")",":","The","device","on","which","the","tests","will","be","run",".","transformers_class","(","`","transformers.PreTrainedModel","`",")",":","The","transformers","class","that","is","being","tested","."]
code: def _test_delete_inactive_adapter(
      self, model_id, config_cls, config_kwargs
  ):
      # same as test_delete_adapter, but this time an inactive adapter is deleted
      supported_peft_types = [
          PeftType.LORA,
          PeftType.LOHA,
          PeftType.LOKR,
          PeftType.IA3,
          PeftType.OFT,
      ]
      # IA3 does not support deleting adapters yet, but it just needs to be added
      # AdaLora does not support multiple adapters
      config = config_cls(
          base_model_name_or_path=model_id,
          **config_kwargs,
      )
      if config.peft_type not in supported_peft_types:
          return
  
      model = self.transformers_class.from_pretrained(model_id)
      adapter_to_delete = "delete_me"
      model = get_peft_model(model, config)
      model.add_adapter(adapter_to_delete, config)
      # "delete_me" is added but not activated
      model = model.to(self.torch_device)
      model.delete_adapter(adapter_to_delete)
      self.assertFalse(adapter_to_delete in model.peft_config)
      self.assertEqual(model.active_adapters, ["default"])
  
      key_list = [key for key, _ in model.named_modules()]
      for key in key_list:
          _, target, _ = _get_submodules(model, key)
          attributes_to_check = getattr(
              target, "adapter_layer_names", []
          ) + getattr(target, "other_param_names", [])
          for attr in attributes_to_check:
              self.assertFalse(
                  adapter_to_delete in getattr(target, attr)
              )
  
      # check that we can also delete the last remaining adapter
      model.delete_adapter("default")
      self.assertFalse("default" in model.peft_config)
      self.assertEqual(model.active_adapters, [])
  
      input = self.prepare_inputs_for_testing()
      # note: we cannot call model(**input) because PeftModel always expects there to be at least one adapter
      model.base_model(**input)
  
imports: import copy
  import json
  import os
  import pickle
  import re
  import tempfile
  from collections import OrderedDict
  from dataclasses import replace
  import torch
  import yaml
  from diffusers import StableDiffusionPipeline
  from peft import AdaLoraConfig, IA3Config, LoraConfig, PeftModel, PeftType, PrefixTuningConfig, PromptEncoderConfig, PromptLearningConfig, PromptTuningConfig, get_peft_model, get_peft_model_state_dict, prepare_model_for_int8_training
  from peft.tuners.lora import LoraLayer
  from peft.utils import _get_submodules, infer_device
  from .testing_utils import get_state_dict
label_desc: Use image node_id 24 for calling the PeftCommonTester obj's underlying member method code with example usage: obj._test_delete_inactive_adapter(model_id, config_cls, config_kwargs) without return types