class_docstr: Transformer with Masked Language Model
code: def init_metrics(self):
      ##### TRAIN
      top_k = 5 if self.num_outputs == self.hparams.vocab_size else 1
  
      self.train_accuracy = torchmetrics.Accuracy(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.train_precision = torchmetrics.Precision(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.train_recall = torchmetrics.Recall(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.train_f1 = torchmetrics.F1Score(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.train_cls_acc = torchmetrics.Accuracy(
          threshold=0.5, num_classes=3, average="macro"
      )
  
      self.train_cls_f1 = torchmetrics.F1Score(
          threshold=0.5,
          num_classes=3,
          average="macro",
      )
  
      ##### VALIDATION
      self.val_accuracy = torchmetrics.Accuracy(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.val_precision = torchmetrics.Precision(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.val_recall = torchmetrics.Recall(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.val_f1 = torchmetrics.F1Score(
          threshold=0.2,
          num_classes=self.num_outputs,
          average="macro",
          mdmc_average="global",
          ignore_index=0,
          top_k=top_k,
      )
  
      self.val_cls_acc = torchmetrics.Accuracy(
          threshold=0.5, num_classes=3, average="macro"
      )
  
      self.val_cls_f1 = torchmetrics.F1Score(
          threshold=0.5,
          num_classes=3,
          average="macro",
      )
  
imports: from abc import ABC
  from base64 import decode
  from math import gamma
  import torch
  import torch.nn
  import torch.nn.functional
  import torchmetrics
  import pickle
  import pytorch_lightning
  from pytorch_lightning import seed_everything
  import os
  from pathlib import Path
  import logging
  from src.transformer.transformer_utils import *
  from src.transformer.transformer import Transformer, MaskedLanguageModel, CLS_Decoder
label_desc: Use image node_id 2 for calling the TransformerEncoder obj's underlying member method code with example usage: obj.init_metrics() without return types