code: def run_prediction_head_test(
      self,
      model,
      compare_model,
      head_name,
      input_shape=None,
      output_shape=(1, 2),
      label_dict=None,
  ):
      # first, check if the head is actually correctly registered as part of the pt module
      self.assertTrue(
          f"heads.{head_name}" in dict(model.named_modules())
      )
  
      # save & reload
      with tempfile.TemporaryDirectory() as temp_dir:
          model.save_head(temp_dir, head_name)
  
          compare_model.load_head(temp_dir)
  
      # check if adapter was correctly loaded
      self.assertTrue(head_name in compare_model.heads)
  
      model.to(torch_device)
      compare_model.to(torch_device)
  
      # make a forward pass
      model.active_head = head_name
      input_shape = input_shape or (self.batch_size, self.seq_length)
      in_data = self.get_input_samples(input_shape, config=model.config)
      if label_dict:
          for k, v in label_dict.items():
              in_data[k] = v
      output1 = model(**in_data)
      # For the Seq2SeqLMOutput logits are at index 0
      # ToDo figure out why
      idx = "logits" if hasattr(output1, "logits") else 1
      self.assertEqual(output_shape, tuple(output1[idx].size()))
      # check equal output
      compare_model.active_head = head_name
      output2 = compare_model(**in_data)
      self.assertEqual(len(output1), len(output2))
      self.assertTrue(torch.equal(output1[idx], output2[idx]))
  
imports: import os
  import tempfile
  import torch
  import adapters
  from adapters import ADAPTER_MODEL_MAPPING, AdapterSetup, AutoAdapterModel
  from adapters.composition import BatchSplit, Stack
  from transformers import AutoModelForSequenceClassification
  from transformers.testing_utils import require_torch, torch_device
  from .methods import create_twin_models
label_desc: Use image node_id 1 for calling the PredictionHeadModelTestMixin obj's underlying member method code with example usage: obj.run_prediction_head_test(model, compare_model, head_name, input_shape, output_shape, label_dict) without return types