fairseq/data/indexed_dataset.py
Killed 0 out of 44 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 248
--- 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 249
--- 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 250
--- 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 251
--- 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 252
--- 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 253
--- 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 254
--- 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 255
--- 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 256
--- 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 257
--- 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 258
--- 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 259
--- 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 260
--- 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 261
--- 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 262
--- 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 263
--- 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 264
--- 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 265
--- 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 266
--- 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 267
--- 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 268
--- 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 269
--- 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 270
--- 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 271
--- 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 272
--- 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 273
--- 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 274
--- 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 275
--- 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 276
--- 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 277
--- 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 278
--- 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 279
--- 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 280
--- 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 281
--- 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 282
--- 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 283
--- 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 284
--- 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 285
--- 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 286
--- 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 287
--- 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 288
--- 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 289
--- 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 290
--- 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 291
--- 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))