docstr_tok: []
code: def forward(
      self,
      input_ids: Optional[torch.Tensor] = None,
      attention_mask: Optional[torch.Tensor] = None,
      token_type_ids: Optional[torch.Tensor] = None,
      position_ids: Optional[torch.Tensor] = None,
      head_mask: Optional[torch.Tensor] = None,
      inputs_embeds: Optional[torch.Tensor] = None,
      encoder_hidden_states: Optional[torch.Tensor] = None,
      encoder_attention_mask: Optional[torch.Tensor] = None,
      output_attentions: Optional[bool] = None,
      return_dict: Optional[bool] = None,
      output_hidden_states: Optional[bool] = None,
  ):
      r""" """
  
      return_dict = (
          return_dict
          if return_dict is not None
          else self.config.use_return_dict
      )
  
      outputs = self.roberta(
          input_ids=input_ids,
          attention_mask=attention_mask,
          token_type_ids=token_type_ids,
          position_ids=position_ids,
          head_mask=head_mask,
          inputs_embeds=inputs_embeds,
          encoder_hidden_states=encoder_hidden_states,
          encoder_attention_mask=encoder_attention_mask,
          output_attentions=output_attentions,
          output_hidden_states=True,
          return_dict=return_dict,
      )
  
      # # last module outputs
      # sequence_output = outputs[0]
  
      # # project every module
      # sequence_output_ln = self.pre_LN(sequence_output)
  
      # # pooler
      # pooler_output = self.pooler(sequence_output_ln)
      # pooler_output = self.transformation(pooler_output)
      # projection_state = self.transformation(outputs.last_hidden_state)
  
      if self.has_pre_transformation:
          sequence_output2 = outputs["hidden_states"][-2]
          sequence_output2 = self.pre_LN(sequence_output2)
          projection_state2 = self.transformation_pre(sequence_output2)
  
          return {
              "projection_state": projection_state2,
              "last_hidden_state": outputs.last_hidden_state,
              "hidden_states": outputs.hidden_states,
              "attentions": outputs.attentions,
          }
      else:
          projection_state = self.transformation(
              outputs.last_hidden_state
          )
          return {
              "projection_state": projection_state,
              "last_hidden_state": outputs.last_hidden_state,
              "hidden_states": outputs.hidden_states,
              "attentions": outputs.attentions,
          }
  
file_path: stable-diffusion-webui/modules/xlmr_m18.py
imports: from transformers import BertPreTrainedModel, BertConfig
  import torch.nn
  import torch
  from transformers.models.xlm_roberta.configuration_xlm_roberta import XLMRobertaConfig
  from transformers import XLMRobertaModel, XLMRobertaTokenizer
  from typing import Optional
label_desc: Use image node_id 3 for calling the BertSeriesModelWithTransformation obj's underlying member method code with example usage: obj.forward(input_ids, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, encoder_hidden_states, encoder_attention_mask, output_attentions, return_dict, output_hidden_states) and returns: dict, dict