code: def test_forward_with_past(self):
      if self.config_class not in ADAPTER_MODEL_MAPPING:
          self.skipTest("Does not support flex heads.")
      if (
          self.config_class
          not in MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING
      ):
          self.skipTest("No causal lm class.")
  
      static_model = MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING[
          self.config_class
      ](self.config())
      adapters.init(static_model)
      flex_model = AutoAdapterModel.from_pretrained(
          None,
          config=self.config(),
          state_dict=static_model.state_dict(),
      )
  
      static_model.add_adapter("dummy")
      static_model.set_active_adapters("dummy")
      static_model.eval()
      flex_model.eval()
      with tempfile.TemporaryDirectory() as temp_dir:
          static_model.save_adapter(temp_dir, "dummy")
  
          loading_info = {}
          flex_model.load_adapter(temp_dir, loading_info=loading_info)
          flex_model.set_active_adapters("dummy")
  
      input_data = self.get_input_samples(config=static_model.config)
      static_model.eval()
      flex_model.eval()
      static_model.to(torch_device)
      flex_model.to(torch_device)
      output = static_model(**input_data)
  
      input_data["past_key_values"] = output["past_key_values"]
      output_base = static_model(**input_data)
      output_with_head = flex_model(**input_data)
      self.assertTrue(
          torch.allclose(
              output_base["logits"], output_with_head["logits"]
          )
      )
  
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 19 for calling the BottleneckAdapterTestMixin obj's underlying member method code with example usage: obj.test_forward_with_past() without return types