Merge branch 'fix/full-dataset' into portability
This commit is contained in:
commit
2de9e87470
4 changed files with 25 additions and 14 deletions
|
|
@ -50,12 +50,12 @@ class Dataset(TorchDataset, ABC):
|
|||
return len(self.dataset)
|
||||
|
||||
def process_data(self):
|
||||
self.chunk_offsets = self.get_offsets()
|
||||
if self.size == -1:
|
||||
# Just use the whole dataset
|
||||
self.bytes = ''.join(tqdm(self.data, desc="Encoding data")).encode('utf-8', errors='replace')
|
||||
else:
|
||||
# Use only partition, calculate offsets
|
||||
self.chunk_offsets = self.get_offsets()
|
||||
self.bytes = ''.join(tqdm(self.data[:len(self.chunk_offsets)], desc="Encoding data")).encode('utf-8', errors='replace')
|
||||
|
||||
bytes_array = np.frombuffer(self.bytes, dtype=np.uint8) # Zero-copy
|
||||
|
|
|
|||
Reference in a new issue