code: def __init__(self, cfg: SentencePredictionConfig, task):
      super().__init__(task)
      self.classification_head_name = cfg.classification_head_name
      self.regression_target = cfg.regression_target
      self.keep_pred_and_targ = (
          cfg.report_mcc
          or cfg.report_acc_and_f1
          or cfg.report_pearson_and_spearman
      )
      self.report_mcc = cfg.report_mcc
      self.report_acc_and_f1 = cfg.report_acc_and_f1
      self.report_pearson_and_spearman = cfg.report_pearson_and_spearman
      self.label_dict = task.label_dictionary
  
imports: import math
  from dataclasses import dataclass, field
  from itertools import chain
  import numpy
  import torch
  import torch.nn.functional
  from sklearn.metrics import f1_score
  from sklearn.metrics import matthews_corrcoef
  from scipy.stats import pearsonr, spearmanr
  from fairseq.logging import metrics
  from fairseq.criterions import FairseqCriterion, register_criterion
  from fairseq.dataclass import FairseqDataclass
  from fairseq.logging.meters import safe_round
label_desc: Use image node_id 1 to create a new SentencePredictionCriterion object from inherited base classes: FairseqCriterion with example: obj = SentencePredictionCriterion(cfg, task)