class_docstr: Base class for all models
      
class_docstr_tok: ["Base","class","for","all","models"]
code: def forward(self, batch, epoch_idx=-1):
      inputs = self.process_forward_inputs(batch)
  
      if self.is_prompt_tuning:
          inputs = self._process_prompt_tuning_input(inputs, batch)
      outputs = self.model(**inputs)
  
      if self.label_smoothing:
          loss_fct = nn.CrossEntropyLoss(
              label_smoothing=self.label_smoothing
          )
          vocab_size = outputs.logits.size(-1)
          if self.is_casual_model:
              logits = outputs.logits[..., :-1, :].contiguous()
              labels = inputs["labels"][..., 1:].contiguous()
          else:
              logits = outputs.logits
              labels = inputs["labels"]
          return loss_fct(logits.view(-1, vocab_size), labels.view(-1))
      else:
          return outputs.loss
  
imports: import torch
  import torch.nn
  from textbox import CLM_MODELS, SEQ2SEQ_MODELS, RNN_MODELS, PLM_MODELS
  from transformers import EncoderDecoderModel
  import os
  from typing import List, Optional, Tuple, Union
  from transformers.modeling_utils import get_parameter_dtype
  from collections import OrderedDict
label_desc: Use image node_id 6 for calling the AbstractModel obj's underlying member method code with example usage: obj.forward(batch, epoch_idx) and returns: loss_fct, outputs