code: def forward(
      self,
      pixel_values: Optional[torch.Tensor] = None,
      bool_masked_pos: Optional[torch.BoolTensor] = None,
      head_mask: Optional[torch.Tensor] = None,
      output_attentions: Optional[bool] = None,
      output_hidden_states: Optional[bool] = None,
      return_dict: Optional[bool] = None,
      head=None,
      output_adapter_gating_scores=False,
      output_adapter_fusion_attentions=False,
      **kwargs,
  ):
      return_dict = (
          return_dict
          if return_dict is not None
          else self.config.use_return_dict
      )
  
      outputs, context = self.beit(
          pixel_values,
          bool_masked_pos=bool_masked_pos,
          head_mask=head_mask,
          output_attentions=output_attentions,
          output_hidden_states=output_hidden_states,
          return_dict=return_dict,
          output_adapter_gating_scores=output_adapter_gating_scores,
          output_adapter_fusion_attentions=output_adapter_fusion_attentions,
          adapter_input_parallelized=kwargs.pop(
              "adapter_input_parallelized", False
          ),
          output_context=True,
      )
      # required e.g. for prompt tuning in all models
      kwargs["context"] = context
  
      # BERT & RoBERTa return the pooled output as second item, we don't need that in these heads
      if not return_dict:
          head_inputs = (outputs[0],) + outputs[2:]
      else:
          head_inputs = outputs
      pooled_output = outputs[1]
  
      if (
          head
          or AdapterSetup.get_context_head_setup()
          or self.active_head
      ):
          head_outputs = self.forward_head(
              head_inputs,
              cls_output=pooled_output,  # BEiT does classification based on average-pooling of last hidden state
              head_name=head,
              return_dict=return_dict,
              pooled_output=pooled_output,
              **kwargs,
          )
          return head_outputs
      else:
          # in case no head is used just return the output of the base model (including pooler output)
          return outputs
  
file_path: adapters/src/adapters/models/beit/adapter_model.py
imports: from typing import Optional
  import torch
  from transformers.models.beit.modeling_beit import BEIT_INPUTS_DOCSTRING, BEIT_START_DOCSTRING, BeitModel, BeitPreTrainedModel
  from transformers.utils import add_start_docstrings, add_start_docstrings_to_model_forward
  from ...context import AdapterSetup
  from ...heads import ImageClassificationHead, ModelWithFlexibleHeadsAdaptersMixin
  from ...wrappers import init
label_desc: Use image node_id 2 for calling the BeitAdapterModel obj's underlying member method code with example usage: obj.forward(pixel_values, bool_masked_pos, head_mask, output_attentions, output_hidden_states, return_dict, head, output_adapter_gating_scores, output_adapter_fusion_attentions) and returns: head_outputs, outputs