Guscerra commited on
Commit
4395688
·
1 Parent(s): 4707167
Files changed (1) hide show
  1. clustering_files.py +7 -3
clustering_files.py CHANGED
@@ -48,7 +48,7 @@ class ClusteringFiles(datasets.GeneratorBasedBuilder):
48
  features = datasets.Features(
49
  {
50
  "filename": datasets.Value("string"),
51
- "segments": [
52
  {
53
  "segment_id": datasets.Value("int32"),
54
  "speaker": datasets.Value("string"),
@@ -60,7 +60,7 @@ class ClusteringFiles(datasets.GeneratorBasedBuilder):
60
  "readable_end": datasets.Value("string"),
61
  "vp": datasets.Sequence(datasets.Value("float32")),
62
  }
63
- ]
64
  })
65
  return datasets.DatasetInfo(
66
  description=description,
@@ -100,8 +100,12 @@ class ClusteringFiles(datasets.GeneratorBasedBuilder):
100
  "end": row['end'],
101
  "readable_start": row['readable_start'],
102
  "readable_end": row['readable_end'],
103
- "vp": np.asarray(row["vp"], dtype=np.float32)
104
  })
105
 
106
  for idx, file_data in enumerate(files.values()):
107
  yield idx, file_data
 
 
 
 
 
48
  features = datasets.Features(
49
  {
50
  "filename": datasets.Value("string"),
51
+ "segments": datasets.Sequence(
52
  {
53
  "segment_id": datasets.Value("int32"),
54
  "speaker": datasets.Value("string"),
 
60
  "readable_end": datasets.Value("string"),
61
  "vp": datasets.Sequence(datasets.Value("float32")),
62
  }
63
+ )
64
  })
65
  return datasets.DatasetInfo(
66
  description=description,
 
100
  "end": row['end'],
101
  "readable_start": row['readable_start'],
102
  "readable_end": row['readable_end'],
103
+ "vp": row["vp"] # Keep as numpy array
104
  })
105
 
106
  for idx, file_data in enumerate(files.values()):
107
  yield idx, file_data
108
+
109
+ # Ensure numpy arrays are properly handled by datasets library
110
+ datasets.config.NUMPY_ARRAYS_AVAILABLE = True
111
+ datasets.config.NUMPY_DTYPE_TO_PYARROW_DTYPE[np.dtype("float32")] = datasets.Value("float32")