docstr: Tests if the invertible adapters are deleted correctly.
docstr_tok: ["Tests","if","the","invertible","adapters","are","deleted","correctly","."]
code: def test_delete_adapter_with_invertible(self):
      """Tests if the invertible adapters are deleted correctly."""
      model = self.get_model().base_model
      model.eval()
      if not isinstance(
          model, InvertibleAdaptersMixin
      ) and not isinstance(model, InvertibleAdaptersWrapperMixin):
          self.skipTest("Model does not support invertible adapters.")
  
      # iterate through all adapter invertible adapter configs
      for (
          adapter_config,
          filter_keys,
      ) in self.inv_adapter_configs_to_test:
          with self.subTest(
              model_class=model.__class__.__name__,
              config=adapter_config.__class__.__name__,
          ):
              name = adapter_config.__class__.__name__
              model.add_adapter(name, config=adapter_config)
              model.set_active_adapters([name])
  
              # check if adapter is correctly added to config
              self.assert_adapter_available(model, name)
              # remove the adapter again
              model.delete_adapter(name)
  
              # check if adapter is correctly removed from the model
              self.assert_adapter_unavailable(model, name)
  
              # check additionally if invertible adapter is removed correctly from the model
              self.assertFalse(name in model.invertible_adapters)
              self.assertEqual(None, model.get_invertible_adapter())
  
              # check that weights are available and active
              has_weights = False
              filter_keys = [k.format(name=name) for k in filter_keys]
              for k, v in self.filter_parameters(
                  model, filter_keys
              ).items():
                  has_weights = True
              self.assertFalse(has_weights)
  
imports: import copy
  import tempfile
  import torch
  import adapters
  from adapters import ADAPTER_CONFIG_MAP, ADAPTER_MODEL_MAPPING, AutoAdapterModel, BatchSplit, DoubleSeqBnConfig, DoubleSeqBnInvConfig, Fuse, InvertibleAdaptersMixin, InvertibleAdaptersWrapperMixin, MAMConfig, SeqBnConfig, SeqBnInvConfig
  from adapters.heads.language_modeling import CausalLMHead
  from transformers import MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, CLIPConfig
  from transformers.testing_utils import require_torch, torch_device
  from .base import AdapterMethodBaseTestMixin, create_twin_models
label_desc: Use image node_id 6 for calling the BottleneckAdapterTestMixin obj's underlying member method code with example usage: obj.test_delete_adapter_with_invertible() without return types