fairseq/criterions/sentence_prediction.py
Killed 0 out of 6 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 1590
--- fairseq/criterions/sentence_prediction.py
+++ fairseq/criterions/sentence_prediction.py
@@ -12,7 +12,7 @@
from fairseq.criterions import FairseqCriterion, register_criterion
-@register_criterion('sentence_prediction')
+@register_criterion('XXsentence_predictionXX')
class SentencePredictionCriterion(FairseqCriterion):
def __init__(self, task, classification_head_name, regression_target):
Mutant 1591
--- fairseq/criterions/sentence_prediction.py
+++ fairseq/criterions/sentence_prediction.py
@@ -11,8 +11,6 @@
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, register_criterion
-
-@register_criterion('sentence_prediction')
class SentencePredictionCriterion(FairseqCriterion):
def __init__(self, task, classification_head_name, regression_target):
Mutant 1592
--- fairseq/criterions/sentence_prediction.py
+++ fairseq/criterions/sentence_prediction.py
@@ -20,7 +20,6 @@
self.classification_head_name = classification_head_name
self.regression_target = regression_target
- @staticmethod
def add_args(parser):
# fmt: off
parser.add_argument('--classification-head-name',
Mutant 1593
--- fairseq/criterions/sentence_prediction.py
+++ fairseq/criterions/sentence_prediction.py
@@ -28,7 +28,7 @@
help='name of the classification head to use')
# fmt: on
- def forward(self, model, sample, reduce=True):
+ def forward(self, model, sample, reduce=False):
"""Compute the loss for the given sample.
Returns a tuple with three elements:
Mutant 1594
--- fairseq/criterions/sentence_prediction.py
+++ fairseq/criterions/sentence_prediction.py
@@ -69,7 +69,6 @@
return loss, sample_size, logging_output
- @staticmethod
def reduce_metrics(logging_outputs) -> None:
"""Aggregate logging outputs from data parallel training."""
loss_sum = sum(log.get('loss', 0) for log in logging_outputs)
Mutant 1595
--- fairseq/criterions/sentence_prediction.py
+++ fairseq/criterions/sentence_prediction.py
@@ -85,7 +85,6 @@
ncorrect = sum(log.get('ncorrect', 0) for log in logging_outputs)
metrics.log_scalar('accuracy', 100.0 * ncorrect / nsentences, nsentences, round=1)
- @staticmethod
def logging_outputs_can_be_summed() -> bool:
"""
Whether the logging outputs returned by `forward` can be summed