class_docstr: Control the loops for training, evaluation, and prediction of Named Entity Recognition. This module is independent of
  the model definition. This class inherits from Lightning's LightningModule:
  https://lightning.ai/docs/pytorch/stable/common/lightning_module.html
code: def _compute_loss(
      self,
      output: Dict,
      label: torch.Tensor,
  ):
      loss = 0
      for prefix, per_output in output.items():
          if prefix == NER_TEXT or prefix == FUSION_NER:
              weight = per_output[WEIGHT] if WEIGHT in per_output else 1
              active_loss = label.view(-1) != 0
              active_logits = per_output[LOGITS].view(
                  -1, self.model.num_classes
              )[active_loss]
              active_labels = label.view(-1)[active_loss]
              loss += (
                  self.loss_func(
                      input=active_logits,
                      target=active_labels,
                  )
                  * weight
              )
      return loss
  
file_path: autogluon/multimodal/src/autogluon/multimodal/optimization/lit_ner.py
imports: import logging
  from typing import Callable, Dict, List, Optional, Union
  import torch
  import torchmetrics
  from torch import nn
  from torch.nn.modules.loss import _Loss
  from ..constants import FUSION_NER, LOGITS, NER_TEXT, WEIGHT
  from ..data.mixup import MixupModule
  from .lit_module import LitModule
label_desc: Use image node_id 2 for calling the NerLitModule obj's underlying member method code with example usage: obj._compute_loss(output, label) and returns: loss