    def build_criterion(self, cfg: DictConfig, from_checkpoint=False):
        """
        Build the :class:`~fairseq.criterions.FairseqCriterion` instance for
        this task.

        Args:
            cfg (omegaconf.DictConfig): configration object

        Returns:
            a :class:`~fairseq.criterions.FairseqCriterion` instance
        """
        from fairseq import criterions

        return criterions.build_criterion(cfg, self, from_checkpoint=from_checkpoint)
Build the :class:`~fairseq.criterions.FairseqCriterion` instance for
this task.

Args:
cfg (omegaconf.DictConfig): configration object

Returns:
a :class:`~fairseq.criterions.FairseqCriterion` instance
fairseq/tasks/fairseq_task.py