docstr: No special modification required for Lightning, define it as you normally would
  in the `nn.Module` in vanilla PyTorch.
docstr_tok: ["No","special","modification","required","for","Lightning",",","define","it","as","you","normally","would","in","the","`","nn.Module","`","in","vanilla","PyTorch","."]
code: def forward(
      self,
      input_ids: torch.Tensor,
      attention_mask: torch.Tensor = None,
      decoder_input_ids: torch.Tensor = None,
      labels: torch.Tensor = None,
  ) -> Tuple[
      torch.Tensor, Optional[torch.Tensor], Optional[torch.Tensor]
  ]:
      """
      No special modification required for Lightning, define it as you normally would
      in the `nn.Module` in vanilla PyTorch.
      """
      outputs = self.model(
          input_ids=input_ids,
          attention_mask=attention_mask,
          decoder_input_ids=decoder_input_ids,
          labels=labels,
          return_dict=False,
      )
      return outputs
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from transformers import AutoModel, BartForConditionalGeneration, EncoderDecoderModel
  from nemo.collections.common.metrics import Perplexity
  from nemo.collections.nlp.data.text2sparql import Text2SparqlDataset
  from nemo.collections.nlp.modules.common.tokenizer_utils import get_tokenizer
  from nemo.core.classes.common import typecheck
  from nemo.core.classes.modelPT import ModelPT
  from nemo.core.neural_types import ChannelType, MaskType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the Text2SparqlModel obj's underlying member method code with example usage: obj.forward(input_ids, attention_mask, decoder_input_ids, labels) and returns: outputs