karolyartur commited on
Commit
868fdaa
1 Parent(s): 2d57e56

Use BytesIO and flattened numpy arrays

Browse files
Files changed (1) hide show
  1. SMVB.py +2 -3
SMVB.py CHANGED
@@ -17,6 +17,7 @@
17
  """SMVB dataset"""
18
 
19
  import sys
 
20
  import numpy as np
21
  if sys.version_info < (3, 9):
22
  from typing import Sequence, Generator, Tuple
@@ -144,6 +145,4 @@ class SMVBDataset(datasets.GeneratorBasedBuilder):
144
  if i%len(keys) < 2:
145
  file_infos.append((file_path, file_object.read()))
146
  else:
147
- with open('temp.npy','wb') as f:
148
- f.write(file_object.read())
149
- file_infos.append((file_path, np.load('temp.npy')))
 
17
  """SMVB dataset"""
18
 
19
  import sys
20
+ import io
21
  import numpy as np
22
  if sys.version_info < (3, 9):
23
  from typing import Sequence, Generator, Tuple
 
145
  if i%len(keys) < 2:
146
  file_infos.append((file_path, file_object.read()))
147
  else:
148
+ file_infos.append((file_path, np.load(io.BytesIO(file_object.read())).flatten()))