Snap
Browse files- vps_clustering_benchmark.py +14 -38
vps_clustering_benchmark.py
CHANGED
@@ -81,44 +81,20 @@ class VPClusteringBenchmark(datasets.GeneratorBasedBuilder):
|
|
81 |
gen_kwargs={"file_path": downloaded_file, "split": "files"},
|
82 |
),
|
83 |
]
|
84 |
-
|
85 |
-
def _generate_examples(self, file_path, split):
|
86 |
"""Yields examples."""
|
87 |
df = pd.read_pickle(file_path)
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
}
|
103 |
-
elif split == "files":
|
104 |
-
files = {}
|
105 |
-
for idx, row in df.iterrows():
|
106 |
-
if row["filename"] not in files:
|
107 |
-
files[row["filename"]] = {
|
108 |
-
"filename": row["filename"],
|
109 |
-
"segments": []
|
110 |
-
}
|
111 |
-
files[row["filename"]]["segments"].append({
|
112 |
-
"segment_id": row["segment_id"],
|
113 |
-
"speaker": row["speaker"],
|
114 |
-
"duration": row["duration"],
|
115 |
-
"segment_clean": row["segment_clean"],
|
116 |
-
"start": row['start'],
|
117 |
-
"end": row['end'],
|
118 |
-
"readable_start": row['readable_start'],
|
119 |
-
"readable_end": row['readable_end'],
|
120 |
-
"vp": np.asarray(row["vp"], dtype=np.float32)
|
121 |
-
})
|
122 |
-
|
123 |
-
for idx, file_data in enumerate(files.values()):
|
124 |
-
yield idx, file_data
|
|
|
81 |
gen_kwargs={"file_path": downloaded_file, "split": "files"},
|
82 |
),
|
83 |
]
|
84 |
+
def _generate_examples(self, file_path):
|
|
|
85 |
"""Yields examples."""
|
86 |
df = pd.read_pickle(file_path)
|
87 |
|
88 |
+
for idx, row in df.iterrows():
|
89 |
+
yield idx, {
|
90 |
+
"segment_id": row["segment_id"],
|
91 |
+
"filename": row["filename"],
|
92 |
+
"speaker": row["speaker"],
|
93 |
+
"duration": row["duration"],
|
94 |
+
"segment_clean": row["segment_clean"],
|
95 |
+
"start": row['start'],
|
96 |
+
"end": row['end'],
|
97 |
+
"readable_start": row['readable_start'],
|
98 |
+
"readable_end": row['readable_end'],
|
99 |
+
"vp": np.asarray(row["vp"], dtype=np.float32)
|
100 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|