code: def nll_loss(targets, pred, target_masks=None, label_smoothing=0):
      """Negative Log-loglikelihood loss (perplexity).
  
      Args:
        targets: ground-truth labels
        pred: predicted logits
        target_masks: mask that don't count
        label_smoothing: factor to smooth label.
  
      Returns:
        loss value
      """
  
      vocab_size = pred.shape[-1]
      onehot_targets = common_utils.onehot(targets, vocab_size)
  
      return base_model_utils.weighted_softmax_cross_entropy(
          pred,
          onehot_targets,
          target_masks,
          label_smoothing=label_smoothing,
      )
  
imports: from absl import logging
  from flax.training import common_utils
  import jax
  import jax.numpy
  from scenic.model_lib.base_models import model_utils
label_desc: Use image node_id 1 for calling a global function with example usage: nll_loss(targets, pred, target_masks, label_smoothing) and returns: base_model_utils