fairseq/data/indexed_dataset.py

Killed 0 out of 44 mutants

Survived

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

Mutant 2975

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -48,7 +48,7 @@
         return IndexedDatasetBuilder(out_file)
 
 
-def make_dataset(path, impl, fix_lua_indexing=False, dictionary=None):
+def make_dataset(path, impl, fix_lua_indexing=True, dictionary=None):
     if impl == 'raw' and IndexedRawTextDataset.exists(path):
         assert dictionary is not None
         return IndexedRawTextDataset(path, dictionary)

Mutant 2976

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -81,7 +81,7 @@
 
 
 dtypes = {
-    1: np.uint8,
+    2: np.uint8,
     2: np.int8,
     3: np.int16,
     4: np.int32,

Mutant 2977

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -82,7 +82,7 @@
 
 dtypes = {
     1: np.uint8,
-    2: np.int8,
+    3: np.int8,
     3: np.int16,
     4: np.int32,
     5: np.int64,

Mutant 2978

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -83,7 +83,7 @@
 dtypes = {
     1: np.uint8,
     2: np.int8,
-    3: np.int16,
+    4: np.int16,
     4: np.int32,
     5: np.int64,
     6: np.float,

Mutant 2979

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -84,7 +84,7 @@
     1: np.uint8,
     2: np.int8,
     3: np.int16,
-    4: np.int32,
+    5: np.int32,
     5: np.int64,
     6: np.float,
     7: np.double,

Mutant 2980

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -85,7 +85,7 @@
     2: np.int8,
     3: np.int16,
     4: np.int32,
-    5: np.int64,
+    6: np.int64,
     6: np.float,
     7: np.double,
     8: np.uint16

Mutant 2981

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -86,7 +86,7 @@
     3: np.int16,
     4: np.int32,
     5: np.int64,
-    6: np.float,
+    7: np.float,
     7: np.double,
     8: np.uint16
 }

Mutant 2982

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -87,7 +87,7 @@
     4: np.int32,
     5: np.int64,
     6: np.float,
-    7: np.double,
+    8: np.double,
     8: np.uint16
 }
 

Mutant 2983

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -88,7 +88,7 @@
     5: np.int64,
     6: np.float,
     7: np.double,
-    8: np.uint16
+    9: np.uint16
 }
 
 

Mutant 2984

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -109,7 +109,7 @@
 
 class IndexedDataset(FairseqDataset):
     """Loader for TorchNet IndexedDataset"""
-    _HDR_MAGIC = b'TNTIDX\x00\x00'
+    _HDR_MAGIC = b'XXTNTIDX\x00\x00XX'
 
     def __init__(self, path, fix_lua_indexing=False):
         super().__init__()

Mutant 2985

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -109,7 +109,7 @@
 
 class IndexedDataset(FairseqDataset):
     """Loader for TorchNet IndexedDataset"""
-    _HDR_MAGIC = b'TNTIDX\x00\x00'
+    _HDR_MAGIC = None
 
     def __init__(self, path, fix_lua_indexing=False):
         super().__init__()

Mutant 2986

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -111,7 +111,7 @@
     """Loader for TorchNet IndexedDataset"""
     _HDR_MAGIC = b'TNTIDX\x00\x00'
 
-    def __init__(self, path, fix_lua_indexing=False):
+    def __init__(self, path, fix_lua_indexing=True):
         super().__init__()
         self.path = path
         self.fix_lua_indexing = fix_lua_indexing

Mutant 2987

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -145,7 +145,7 @@
         if self.data_file:
             self.data_file.close()
 
-    @lru_cache(maxsize=8)
+    @lru_cache(maxsize=9)
     def __getitem__(self, i):
         if not self.data_file:
             self.read_data(self.path)

Mutant 2988

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -145,7 +145,6 @@
         if self.data_file:
             self.data_file.close()
 
-    @lru_cache(maxsize=8)
     def __getitem__(self, i):
         if not self.data_file:
             self.read_data(self.path)

Mutant 2989

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -168,7 +168,6 @@
     def size(self, index):
         return self.sizes[index]
 
-    @staticmethod
     def exists(path):
         return (
             os.path.exists(index_file_path(path)) and os.path.exists(data_file_path(path))

Mutant 2990

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -174,7 +174,6 @@
             os.path.exists(index_file_path(path)) and os.path.exists(data_file_path(path))
         )
 
-    @property
     def supports_prefetch(self):
         return False  # avoid prefetching to save memory
 

Mutant 2991

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -181,7 +181,7 @@
 
 class IndexedCachedDataset(IndexedDataset):
 
-    def __init__(self, path, fix_lua_indexing=False):
+    def __init__(self, path, fix_lua_indexing=True):
         super().__init__(path, fix_lua_indexing=fix_lua_indexing)
         self.cache = None
         self.cache_index = {}

Mutant 2992

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -186,7 +186,6 @@
         self.cache = None
         self.cache_index = {}
 
-    @property
     def supports_prefetch(self):
         return True
 

Mutant 2993

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -214,7 +214,7 @@
             self.data_file.close()
             self.data_file = None
 
-    @lru_cache(maxsize=8)
+    @lru_cache(maxsize=9)
     def __getitem__(self, i):
         self.check_index(i)
         tensor_size = self.sizes[self.dim_offsets[i]:self.dim_offsets[i + 1]]

Mutant 2994

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -214,7 +214,6 @@
             self.data_file.close()
             self.data_file = None
 
-    @lru_cache(maxsize=8)
     def __getitem__(self, i):
         self.check_index(i)
         tensor_size = self.sizes[self.dim_offsets[i]:self.dim_offsets[i + 1]]

Mutant 2995

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -231,7 +231,7 @@
     """Takes a text file as input and binarizes it in memory at instantiation.
     Original lines are also kept in memory"""
 
-    def __init__(self, path, dictionary, append_eos=True, reverse_order=False):
+    def __init__(self, path, dictionary, append_eos=False, reverse_order=False):
         self.tokens_list = []
         self.lines = []
         self.sizes = []

Mutant 2996

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -231,7 +231,7 @@
     """Takes a text file as input and binarizes it in memory at instantiation.
     Original lines are also kept in memory"""
 
-    def __init__(self, path, dictionary, append_eos=True, reverse_order=False):
+    def __init__(self, path, dictionary, append_eos=True, reverse_order=True):
         self.tokens_list = []
         self.lines = []
         self.sizes = []

Mutant 2997

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -256,7 +256,7 @@
         if i < 0 or i >= self.size:
             raise IndexError('index out of range')
 
-    @lru_cache(maxsize=8)
+    @lru_cache(maxsize=9)
     def __getitem__(self, i):
         self.check_index(i)
         return self.tokens_list[i]

Mutant 2998

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -256,7 +256,6 @@
         if i < 0 or i >= self.size:
             raise IndexError('index out of range')
 
-    @lru_cache(maxsize=8)
     def __getitem__(self, i):
         self.check_index(i)
         return self.tokens_list[i]

Mutant 2999

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -277,7 +277,6 @@
     def size(self, index):
         return self.sizes[index]
 
-    @staticmethod
     def exists(path):
         return os.path.exists(path)
 

Mutant 3000

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -284,7 +284,7 @@
 
 class IndexedDatasetBuilder(object):
     element_sizes = {
-        np.uint8: 1,
+        np.uint8: 2,
         np.int8: 1,
         np.int16: 2,
         np.int32: 4,

Mutant 3001

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -285,7 +285,7 @@
 class IndexedDatasetBuilder(object):
     element_sizes = {
         np.uint8: 1,
-        np.int8: 1,
+        np.int8: 2,
         np.int16: 2,
         np.int32: 4,
         np.int64: 8,

Mutant 3002

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -286,7 +286,7 @@
     element_sizes = {
         np.uint8: 1,
         np.int8: 1,
-        np.int16: 2,
+        np.int16: 3,
         np.int32: 4,
         np.int64: 8,
         np.float: 4,

Mutant 3003

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -287,7 +287,7 @@
         np.uint8: 1,
         np.int8: 1,
         np.int16: 2,
-        np.int32: 4,
+        np.int32: 5,
         np.int64: 8,
         np.float: 4,
         np.double: 8

Mutant 3004

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -288,7 +288,7 @@
         np.int8: 1,
         np.int16: 2,
         np.int32: 4,
-        np.int64: 8,
+        np.int64: 9,
         np.float: 4,
         np.double: 8
     }

Mutant 3005

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -289,7 +289,7 @@
         np.int16: 2,
         np.int32: 4,
         np.int64: 8,
-        np.float: 4,
+        np.float: 5,
         np.double: 8
     }
 

Mutant 3006

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -290,7 +290,7 @@
         np.int32: 4,
         np.int64: 8,
         np.float: 4,
-        np.double: 8
+        np.double: 9
     }
 
     def __init__(self, out_file, dtype=np.int32):

Mutant 3007

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -350,7 +350,7 @@
 
 class MMapIndexedDataset(torch.utils.data.Dataset):
     class Index(object):
-        _HDR_MAGIC = b'MMIDIDX\x00\x00'
+        _HDR_MAGIC = b'XXMMIDIDX\x00\x00XX'
 
         @classmethod
         def writer(cls, path, dtype):

Mutant 3008

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -350,7 +350,7 @@
 
 class MMapIndexedDataset(torch.utils.data.Dataset):
     class Index(object):
-        _HDR_MAGIC = b'MMIDIDX\x00\x00'
+        _HDR_MAGIC = None
 
         @classmethod
         def writer(cls, path, dtype):

Mutant 3009

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -352,7 +352,6 @@
     class Index(object):
         _HDR_MAGIC = b'MMIDIDX\x00\x00'
 
-        @classmethod
         def writer(cls, path, dtype):
             class _Writer(object):
                 def __enter__(self):

Mutant 3010

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -423,7 +423,6 @@
             self._bin_buffer_mmap._mmap.close()
             del self._bin_buffer_mmap
 
-        @property
         def dtype(self):
             return self._dtype
 

Mutant 3011

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -427,7 +427,6 @@
         def dtype(self):
             return self._dtype
 
-        @property
         def sizes(self):
             return self._sizes
 

Mutant 3012

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -431,7 +431,7 @@
         def sizes(self):
             return self._sizes
 
-        @lru_cache(maxsize=8)
+        @lru_cache(maxsize=9)
         def __getitem__(self, i):
             return self._pointers[i], self._sizes[i]
 

Mutant 3013

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -431,7 +431,6 @@
         def sizes(self):
             return self._sizes
 
-        @lru_cache(maxsize=8)
         def __getitem__(self, i):
             return self._pointers[i], self._sizes[i]
 

Mutant 3014

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -469,7 +469,7 @@
     def __len__(self):
         return len(self._index)
 
-    @lru_cache(maxsize=8)
+    @lru_cache(maxsize=9)
     def __getitem__(self, i):
         ptr, size = self._index[i]
         np_array = np.frombuffer(self._bin_buffer, dtype=self._index.dtype, count=size, offset=ptr)

Mutant 3015

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -469,7 +469,6 @@
     def __len__(self):
         return len(self._index)
 
-    @lru_cache(maxsize=8)
     def __getitem__(self, i):
         ptr, size = self._index[i]
         np_array = np.frombuffer(self._bin_buffer, dtype=self._index.dtype, count=size, offset=ptr)

Mutant 3016

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -478,7 +478,6 @@
 
         return torch.from_numpy(np_array)
 
-    @property
     def sizes(self):
         return self._index.sizes
 

Mutant 3017

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -482,7 +482,6 @@
     def sizes(self):
         return self._index.sizes
 
-    @property
     def supports_prefetch(self):
         return False
 

Mutant 3018

--- fairseq/data/indexed_dataset.py
+++ fairseq/data/indexed_dataset.py
@@ -486,7 +486,6 @@
     def supports_prefetch(self):
         return False
 
-    @staticmethod
     def exists(path):
         return (
             os.path.exists(index_file_path(path)) and os.path.exists(data_file_path(path))