code: def validation_step(self, batch, batch_idx, dataset_idx=0):
      if batch is None:
          return
      image_tensors, decoder_input_ids, _ = batch
      if image_tensors is None:
          return
      markdown = pad_sequence(
          decoder_input_ids,
          batch_first=True,
      )
      preds = self.model.inference(
          image_tensors=image_tensors,
          return_attentions=False,
      )["predictions"]
      gts = self.model.decoder.tokenizer.batch_decode(
          markdown, skip_special_tokens=True
      )
      metrics = get_metrics(gts, preds, pool=False)
      scores = {
          "val/" + key: sum(values) / len(values)
          for key, values in metrics.items()
      }
      self.validation_step_outputs.append(scores)
      return scores
  
imports: import math
  import random
  from pathlib import Path
  import numpy
  import lightning.pytorch
  import torch
  from lightning.pytorch.utilities import rank_zero_only
  from torch.nn.utils.rnn import pad_sequence
  from torch.optim.lr_scheduler import LambdaLR
  from torch.utils.data import DataLoader
  from nougat import NougatConfig, NougatModel
  from nougat.metrics import get_metrics
label_desc: Use image node_id 3 for calling the NougatModelPLModule obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx, dataset_idx) and returns: scores