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_unload_adapter(self, model_id, config_cls, config_kwargs):
      model = self.transformers_class.from_pretrained(model_id)
      config = config_cls(
          base_model_name_or_path=model_id,
          **config_kwargs,
      )
      model = get_peft_model(model, config)
      model = model.to(self.torch_device)
  
      if config.peft_type not in ("LORA", "ADALORA", "IA3"):
          with self.assertRaises(AttributeError):
              model = model.unload()
      else:
          dummy_input = self.prepare_inputs_for_testing()
          logits_with_adapter = model(**dummy_input)[0]
  
          transformers_model = self.transformers_class.from_pretrained(
              model_id
          ).to(self.torch_device)
          logits_transformers = transformers_model(**dummy_input)[0]
  
          model.eval()
          model = model.unload()
          logits_unload = model(**dummy_input)[0]
  
          self.assertFalse(
              torch.allclose(
                  logits_with_adapter,
                  logits_unload,
                  atol=1e-10,
                  rtol=1e-10,
              )
          )
          self.assertTrue(
              torch.allclose(
                  logits_transformers,
                  logits_unload,
                  atol=1e-4,
                  rtol=1e-4,
              )
          )
  
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 25 for calling the PeftCommonTester obj's underlying member method code with example usage: obj._test_unload_adapter(model_id, config_cls, config_kwargs) without return types