fairseq/tasks/cross_lingual_lm.py

Killed 1 out of 27 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 2172

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -24,7 +24,7 @@
 from fairseq.tasks import FairseqTask, register_task
 from fairseq import utils
 
-logger = logging.getLogger(__name__)
+logger = None
 
 
 @register_task('cross_lingual_lm')

Mutant 2173

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -27,7 +27,7 @@
 logger = logging.getLogger(__name__)
 
 
-@register_task('cross_lingual_lm')
+@register_task('XXcross_lingual_lmXX')
 class CrossLingualLMTask(FairseqTask):
     """
     Task for training cross-lingual language models.

Mutant 2174

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -26,8 +26,6 @@
 
 logger = logging.getLogger(__name__)
 
-
-@register_task('cross_lingual_lm')
 class CrossLingualLMTask(FairseqTask):
     """
     Task for training cross-lingual language models.

Mutant 2175

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -38,7 +38,6 @@
         dictionary (Dictionary): the dictionary for the input of the task
     """
 
-    @staticmethod
     def add_args(parser):
         """Add task-specific arguments to the parser."""
         parser.add_argument('data', help='colon separated path to data directories list, \

Mutant 2176

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -41,7 +41,7 @@
     @staticmethod
     def add_args(parser):
         """Add task-specific arguments to the parser."""
-        parser.add_argument('data', help='colon separated path to data directories list, \
+        parser.add_argument('XXdataXX', help='colon separated path to data directories list, \
                             will be iterated upon during epochs in round-robin manner')
         parser.add_argument('--tokens-per-sample', default=512, type=int,
                             help='max number of total tokens over all segments'

Mutant 2177

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -41,8 +41,8 @@
     @staticmethod
     def add_args(parser):
         """Add task-specific arguments to the parser."""
-        parser.add_argument('data', help='colon separated path to data directories list, \
-                            will be iterated upon during epochs in round-robin manner')
+        parser.add_argument('data', help='XXcolon separated path to data directories list, \
+                            will be iterated upon during epochs in round-robin mannerXX')
         parser.add_argument('--tokens-per-sample', default=512, type=int,
                             help='max number of total tokens over all segments'
                                  ' per sample')

Mutant 2178

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -43,7 +43,7 @@
         """Add task-specific arguments to the parser."""
         parser.add_argument('data', help='colon separated path to data directories list, \
                             will be iterated upon during epochs in round-robin manner')
-        parser.add_argument('--tokens-per-sample', default=512, type=int,
+        parser.add_argument('XX--tokens-per-sampleXX', default=512, type=int,
                             help='max number of total tokens over all segments'
                                  ' per sample')
         parser.add_argument('--monolingual-langs', default='en', type=str,

Mutant 2179

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -43,7 +43,7 @@
         """Add task-specific arguments to the parser."""
         parser.add_argument('data', help='colon separated path to data directories list, \
                             will be iterated upon during epochs in round-robin manner')
-        parser.add_argument('--tokens-per-sample', default=512, type=int,
+        parser.add_argument('--tokens-per-sample', default=513, type=int,
                             help='max number of total tokens over all segments'
                                  ' per sample')
         parser.add_argument('--monolingual-langs', default='en', type=str,

Mutant 2180

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -44,7 +44,7 @@
         parser.add_argument('data', help='colon separated path to data directories list, \
                             will be iterated upon during epochs in round-robin manner')
         parser.add_argument('--tokens-per-sample', default=512, type=int,
-                            help='max number of total tokens over all segments'
+                            help='XXmax number of total tokens over all segmentsXX'
                                  ' per sample')
         parser.add_argument('--monolingual-langs', default='en', type=str,
                             help='comma separated list of languages for which we'

Mutant 2181

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -46,7 +46,7 @@
         parser.add_argument('--tokens-per-sample', default=512, type=int,
                             help='max number of total tokens over all segments'
                                  ' per sample')
-        parser.add_argument('--monolingual-langs', default='en', type=str,
+        parser.add_argument('XX--monolingual-langsXX', default='en', type=str,
                             help='comma separated list of languages for which we'
                                  ' want to train XLM on')
         parser.add_argument('--shuffle', action='store_true',

Mutant 2182

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -46,7 +46,7 @@
         parser.add_argument('--tokens-per-sample', default=512, type=int,
                             help='max number of total tokens over all segments'
                                  ' per sample')
-        parser.add_argument('--monolingual-langs', default='en', type=str,
+        parser.add_argument('--monolingual-langs', default='XXenXX', type=str,
                             help='comma separated list of languages for which we'
                                  ' want to train XLM on')
         parser.add_argument('--shuffle', action='store_true',

Mutant 2183

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -47,7 +47,7 @@
                             help='max number of total tokens over all segments'
                                  ' per sample')
         parser.add_argument('--monolingual-langs', default='en', type=str,
-                            help='comma separated list of languages for which we'
+                            help='XXcomma separated list of languages for which weXX'
                                  ' want to train XLM on')
         parser.add_argument('--shuffle', action='store_true',
                             help='shuffle each monolingual dataset while'

Mutant 2184

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -49,7 +49,7 @@
         parser.add_argument('--monolingual-langs', default='en', type=str,
                             help='comma separated list of languages for which we'
                                  ' want to train XLM on')
-        parser.add_argument('--shuffle', action='store_true',
+        parser.add_argument('XX--shuffleXX', action='store_true',
                             help='shuffle each monolingual dataset while'
                             ' training')
 

Mutant 2186

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -50,7 +50,7 @@
                             help='comma separated list of languages for which we'
                                  ' want to train XLM on')
         parser.add_argument('--shuffle', action='store_true',
-                            help='shuffle each monolingual dataset while'
+                            help='XXshuffle each monolingual dataset whileXX'
                             ' training')
 
     def __init__(self, args, dictionary):

Mutant 2187

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -74,7 +74,6 @@
             lang2id[lang] = id
         return lang2id
 
-    @classmethod
     def load_dictionary(cls, filename):
         return MaskedLMDictionary.load(filename)
 

Mutant 2188

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -78,7 +78,6 @@
     def load_dictionary(cls, filename):
         return MaskedLMDictionary.load(filename)
 
-    @classmethod
     def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8):
         d = MaskedLMDictionary()
         for filename in filenames:

Mutant 2189

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -79,7 +79,7 @@
         return MaskedLMDictionary.load(filename)
 
     @classmethod
-    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8):
+    def build_dictionary(cls, filenames, workers=2, threshold=-1, nwords=-1, padding_factor=8):
         d = MaskedLMDictionary()
         for filename in filenames:
             Dictionary.add_file_to_dictionary(filename, d, tokenizer.tokenize_line, workers)

Mutant 2190

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -79,7 +79,7 @@
         return MaskedLMDictionary.load(filename)
 
     @classmethod
-    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8):
+    def build_dictionary(cls, filenames, workers=1, threshold=+1, nwords=-1, padding_factor=8):
         d = MaskedLMDictionary()
         for filename in filenames:
             Dictionary.add_file_to_dictionary(filename, d, tokenizer.tokenize_line, workers)

Mutant 2191

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -79,7 +79,7 @@
         return MaskedLMDictionary.load(filename)
 
     @classmethod
-    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8):
+    def build_dictionary(cls, filenames, workers=1, threshold=-2, nwords=-1, padding_factor=8):
         d = MaskedLMDictionary()
         for filename in filenames:
             Dictionary.add_file_to_dictionary(filename, d, tokenizer.tokenize_line, workers)

Mutant 2192

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -79,7 +79,7 @@
         return MaskedLMDictionary.load(filename)
 
     @classmethod
-    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8):
+    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=+1, padding_factor=8):
         d = MaskedLMDictionary()
         for filename in filenames:
             Dictionary.add_file_to_dictionary(filename, d, tokenizer.tokenize_line, workers)

Mutant 2193

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -79,7 +79,7 @@
         return MaskedLMDictionary.load(filename)
 
     @classmethod
-    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8):
+    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-2, padding_factor=8):
         d = MaskedLMDictionary()
         for filename in filenames:
             Dictionary.add_file_to_dictionary(filename, d, tokenizer.tokenize_line, workers)

Mutant 2194

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -79,7 +79,7 @@
         return MaskedLMDictionary.load(filename)
 
     @classmethod
-    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=8):
+    def build_dictionary(cls, filenames, workers=1, threshold=-1, nwords=-1, padding_factor=9):
         d = MaskedLMDictionary()
         for filename in filenames:
             Dictionary.add_file_to_dictionary(filename, d, tokenizer.tokenize_line, workers)

Mutant 2195

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -86,7 +86,6 @@
         d.finalize(threshold=threshold, nwords=nwords, padding_factor=padding_factor)
         return d
 
-    @property
     def target_dictionary(self):
         return self.dictionary
 

Mutant 2196

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -90,7 +90,6 @@
     def target_dictionary(self):
         return self.dictionary
 
-    @classmethod
     def setup_task(cls, args, **kwargs):
         """Setup the task."""
         dictionary = MaskedLMDictionary.load(os.path.join(args.data, 'dict.txt'))

Mutant 2197

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -136,7 +136,7 @@
 
         return dataset, sizes
 
-    def load_dataset(self, split, epoch=1, combine=False, **kwargs):
+    def load_dataset(self, split, epoch=2, combine=False, **kwargs):
         """Load a given dataset split.
 
         Args:

Mutant 2198

--- fairseq/tasks/cross_lingual_lm.py
+++ fairseq/tasks/cross_lingual_lm.py
@@ -136,7 +136,7 @@
 
         return dataset, sizes
 
-    def load_dataset(self, split, epoch=1, combine=False, **kwargs):
+    def load_dataset(self, split, epoch=1, combine=True, **kwargs):
         """Load a given dataset split.
 
         Args: