class_docstr: Token Classification Model with BERT, applicable for tasks such as Named Entity Recognition
class_docstr_tok: ["Token","Classification","Model","with","BERT",",","applicable","for","tasks","such","as","Named","Entity","Recognition"]
docstr: Called at the end of validation to aggregate outputs.
  outputs: list of individual outputs of each validation step.
docstr_tok: ["Called","at","the","end","of","validation","to","aggregate","outputs",".","outputs",":","list","of","individual","outputs","of","each","validation","step","."]
code: def on_validation_epoch_end(self):
      """
      Called at the end of validation to aggregate outputs.
      outputs: list of individual outputs of each validation step.
      """
      avg_loss = torch.stack(
          [x["val_loss"] for x in self.validation_step_outputs]
      ).mean()
  
      # calculate metrics and classification report
      (
          precision,
          recall,
          f1,
          report,
      ) = self.classification_report.compute()
  
      logging.info(report)
  
      self.log("val_loss", avg_loss, prog_bar=True)
      self.log("precision", precision)
      self.log("f1", f1)
      self.log("recall", recall)
  
      self.classification_report.reset()
      self.validation_step_outputs.clear()
  
imports: import os
  from typing import List, Optional, Union
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from torch.utils.data import DataLoader
  from nemo.collections.common.losses import CrossEntropyLoss
  from nemo.collections.nlp.data.data_utils.data_preprocessing import get_labels_to_labels_id_mapping
  from nemo.collections.nlp.data.token_classification.token_classification_dataset import BertTokenClassificationDataset, BertTokenClassificationInferDataset
  from nemo.collections.nlp.data.token_classification.token_classification_utils import get_label_ids
  from nemo.collections.nlp.metrics.classification_report import ClassificationReport
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.collections.nlp.modules.common import TokenClassifier
  from nemo.collections.nlp.parts.utils_funcs import get_classification_report, plot_confusion_matrix, tensor2list
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.utils import logging
label_desc: Use image node_id 7 for calling the TokenClassificationModel obj's underlying member method code with example usage: obj.on_validation_epoch_end() without return types