class_docstr: Simplified transformer wrapper.
class_docstr_tok: ["Simplified","transformer","wrapper","."]
code: def forward(
      self,
      input_ids,
      attention_mask: Optional[torch.Tensor] = None,
      labels: Optional[torch.Tensor] = None,
  ):
      if attention_mask is not None:
          attention_mask = get_extended_attention_mask(
              attention_mask, input_ids.shape, self.use_causal_attention
          )
      hidden_states = self.embedding(input_ids)
  
      if self.seq_first:
          hidden_states = hidden_states.transpose(0, 1).contiguous()
  
      for i, layer_module in enumerate(self.layers):
          hidden_states = layer_module(hidden_states, attention_mask)
  
      if self.seq_first:
          hidden_states = hidden_states.transpose(0, 1).contiguous()
  
      return self.final_norm(hidden_states)
  
imports: import torch
  from transformers import PretrainedConfig, PreTrainedModel
  from transformers import AutoConfig, AutoModel, AutoModelForMaskedLM, AutoModelForSequenceClassification, AutoModelForTokenClassification
  from typing import Optional
  from omegaconf import OmegaConf
  from .fff import FFF
  from .components import _get_norm_fn, _get_nonlin_fn, EmbeddingComponent, PoolingComponent, PredictionHeadComponent, GLU, get_extended_attention_mask, _init_module
  from .attention import get_attention_mechanism
label_desc: Use image node_id 3 for calling the ScriptableLM obj's underlying member method code with example usage: obj.forward(input_ids, attention_mask, labels) and returns: self