soerenray commited on
Commit
7b011ad
1 Parent(s): f45b696

Upload exploration.ipynb with huggingface_hub

Browse files
Files changed (1) hide show
  1. exploration.ipynb +410 -0
exploration.ipynb ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "4991385a-1cc9-4cd7-b144-36dc0478fafe",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "#!pip install renumics-spotlight datasets[audio]"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 1,
16
+ "id": "a32c61a3-b0f8-430b-9c4d-ff27a1a7942e",
17
+ "metadata": {},
18
+ "outputs": [],
19
+ "source": [
20
+ "import datasets\n",
21
+ "from renumics import spotlight"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "code",
26
+ "execution_count": 2,
27
+ "id": "fada8bfa-c2ea-441a-9d07-f67fa8047138",
28
+ "metadata": {},
29
+ "outputs": [
30
+ {
31
+ "data": {
32
+ "application/vnd.jupyter.widget-view+json": {
33
+ "model_id": "793bc6d31f7c430f99c5a535c9f810e2",
34
+ "version_major": 2,
35
+ "version_minor": 0
36
+ },
37
+ "text/plain": [
38
+ "Downloading readme: 0%| | 0.00/782 [00:00<?, ?B/s]"
39
+ ]
40
+ },
41
+ "metadata": {},
42
+ "output_type": "display_data"
43
+ },
44
+ {
45
+ "data": {
46
+ "application/vnd.jupyter.widget-view+json": {
47
+ "model_id": "d5a8278532bf48669b3c6322184f4a08",
48
+ "version_major": 2,
49
+ "version_minor": 0
50
+ },
51
+ "text/plain": [
52
+ "Downloading data files: 0%| | 0/3 [00:00<?, ?it/s]"
53
+ ]
54
+ },
55
+ "metadata": {},
56
+ "output_type": "display_data"
57
+ },
58
+ {
59
+ "data": {
60
+ "application/vnd.jupyter.widget-view+json": {
61
+ "model_id": "fc555fe7338e4e2283195c5fcd197383",
62
+ "version_major": 2,
63
+ "version_minor": 0
64
+ },
65
+ "text/plain": [
66
+ "Downloading data: 0%| | 0.00/10.6M [00:00<?, ?B/s]"
67
+ ]
68
+ },
69
+ "metadata": {},
70
+ "output_type": "display_data"
71
+ },
72
+ {
73
+ "data": {
74
+ "application/vnd.jupyter.widget-view+json": {
75
+ "model_id": "f562fcb145974bacb44deb1601095a22",
76
+ "version_major": 2,
77
+ "version_minor": 0
78
+ },
79
+ "text/plain": [
80
+ "Downloading data: 0%| | 0.00/1.41M [00:00<?, ?B/s]"
81
+ ]
82
+ },
83
+ "metadata": {},
84
+ "output_type": "display_data"
85
+ },
86
+ {
87
+ "data": {
88
+ "application/vnd.jupyter.widget-view+json": {
89
+ "model_id": "4574322be3824d749649a01ddc28ca82",
90
+ "version_major": 2,
91
+ "version_minor": 0
92
+ },
93
+ "text/plain": [
94
+ "Downloading data: 0%| | 0.00/638k [00:00<?, ?B/s]"
95
+ ]
96
+ },
97
+ "metadata": {},
98
+ "output_type": "display_data"
99
+ },
100
+ {
101
+ "data": {
102
+ "application/vnd.jupyter.widget-view+json": {
103
+ "model_id": "ef4f9b9247e545759e5c2d5b40315de7",
104
+ "version_major": 2,
105
+ "version_minor": 0
106
+ },
107
+ "text/plain": [
108
+ "Extracting data files: 0%| | 0/3 [00:00<?, ?it/s]"
109
+ ]
110
+ },
111
+ "metadata": {},
112
+ "output_type": "display_data"
113
+ },
114
+ {
115
+ "data": {
116
+ "application/vnd.jupyter.widget-view+json": {
117
+ "model_id": "fdc18a8dc915447486fb922ba67d7299",
118
+ "version_major": 2,
119
+ "version_minor": 0
120
+ },
121
+ "text/plain": [
122
+ "Generating train split: 0%| | 0/51093 [00:00<?, ? examples/s]"
123
+ ]
124
+ },
125
+ "metadata": {},
126
+ "output_type": "display_data"
127
+ },
128
+ {
129
+ "data": {
130
+ "application/vnd.jupyter.widget-view+json": {
131
+ "model_id": "844dede7e86d48449b913bbf105aa355",
132
+ "version_major": 2,
133
+ "version_minor": 0
134
+ },
135
+ "text/plain": [
136
+ "Generating validation split: 0%| | 0/6799 [00:00<?, ? examples/s]"
137
+ ]
138
+ },
139
+ "metadata": {},
140
+ "output_type": "display_data"
141
+ },
142
+ {
143
+ "data": {
144
+ "application/vnd.jupyter.widget-view+json": {
145
+ "model_id": "6e988cd434ea4f10bfc5709b100a1a06",
146
+ "version_major": 2,
147
+ "version_minor": 0
148
+ },
149
+ "text/plain": [
150
+ "Generating test split: 0%| | 0/3081 [00:00<?, ? examples/s]"
151
+ ]
152
+ },
153
+ "metadata": {},
154
+ "output_type": "display_data"
155
+ }
156
+ ],
157
+ "source": [
158
+ "dataset = datasets.load_dataset(\"renumics/speech_commands_enrichment_only\")\n",
159
+ "raw_dataset = datasets.load_dataset(\"speech_commands\", 'v0.01')"
160
+ ]
161
+ },
162
+ {
163
+ "cell_type": "code",
164
+ "execution_count": 3,
165
+ "id": "7e486382-31cd-4b69-8a9e-fe3d7ac94b41",
166
+ "metadata": {},
167
+ "outputs": [
168
+ {
169
+ "data": {
170
+ "text/plain": [
171
+ "DatasetDict({\n",
172
+ " train: Dataset({\n",
173
+ " features: ['label_string', 'probability', 'probability_vector', 'prediction', 'prediction_string', 'embedding_reduced', '__index_level_0__'],\n",
174
+ " num_rows: 51093\n",
175
+ " })\n",
176
+ " validation: Dataset({\n",
177
+ " features: ['label_string', 'probability', 'probability_vector', 'prediction', 'prediction_string', 'embedding_reduced', '__index_level_0__'],\n",
178
+ " num_rows: 6799\n",
179
+ " })\n",
180
+ " test: Dataset({\n",
181
+ " features: ['label_string', 'probability', 'probability_vector', 'prediction', 'prediction_string', 'embedding_reduced', '__index_level_0__'],\n",
182
+ " num_rows: 3081\n",
183
+ " })\n",
184
+ "})"
185
+ ]
186
+ },
187
+ "execution_count": 3,
188
+ "metadata": {},
189
+ "output_type": "execute_result"
190
+ }
191
+ ],
192
+ "source": [
193
+ "dataset"
194
+ ]
195
+ },
196
+ {
197
+ "cell_type": "code",
198
+ "execution_count": 4,
199
+ "id": "9594c54a-c024-4492-af7b-f1c25bb4de6b",
200
+ "metadata": {},
201
+ "outputs": [
202
+ {
203
+ "data": {
204
+ "text/plain": [
205
+ "DatasetDict({\n",
206
+ " train: Dataset({\n",
207
+ " features: ['file', 'audio', 'label', 'is_unknown', 'speaker_id', 'utterance_id'],\n",
208
+ " num_rows: 51093\n",
209
+ " })\n",
210
+ " validation: Dataset({\n",
211
+ " features: ['file', 'audio', 'label', 'is_unknown', 'speaker_id', 'utterance_id'],\n",
212
+ " num_rows: 6799\n",
213
+ " })\n",
214
+ " test: Dataset({\n",
215
+ " features: ['file', 'audio', 'label', 'is_unknown', 'speaker_id', 'utterance_id'],\n",
216
+ " num_rows: 3081\n",
217
+ " })\n",
218
+ "})"
219
+ ]
220
+ },
221
+ "execution_count": 4,
222
+ "metadata": {},
223
+ "output_type": "execute_result"
224
+ }
225
+ ],
226
+ "source": [
227
+ "raw_dataset"
228
+ ]
229
+ },
230
+ {
231
+ "cell_type": "code",
232
+ "execution_count": 5,
233
+ "id": "ddda31eb-fdab-4ed3-81cc-88506ae0d7d5",
234
+ "metadata": {},
235
+ "outputs": [],
236
+ "source": [
237
+ "joined_dataset_enrichment = datasets.concatenate_datasets([dataset[\"train\"], dataset[\"validation\"], dataset[\"test\"]])\n",
238
+ "raw_dataset_joined = datasets.concatenate_datasets([raw_dataset[\"train\"].sort(\"file\"), raw_dataset[\"validation\"].sort(\"file\"), \n",
239
+ " raw_dataset[\"test\"].sort(\"file\")])"
240
+ ]
241
+ },
242
+ {
243
+ "cell_type": "code",
244
+ "execution_count": 6,
245
+ "id": "2b8918a3-5037-4062-b9cd-40b4a8a4d6c0",
246
+ "metadata": {},
247
+ "outputs": [
248
+ {
249
+ "data": {
250
+ "text/plain": [
251
+ "Dataset({\n",
252
+ " features: ['label_string', 'probability', 'probability_vector', 'prediction', 'prediction_string', 'embedding_reduced', '__index_level_0__'],\n",
253
+ " num_rows: 60973\n",
254
+ "})"
255
+ ]
256
+ },
257
+ "execution_count": 6,
258
+ "metadata": {},
259
+ "output_type": "execute_result"
260
+ }
261
+ ],
262
+ "source": [
263
+ "joined_dataset_enrichment"
264
+ ]
265
+ },
266
+ {
267
+ "cell_type": "code",
268
+ "execution_count": 7,
269
+ "id": "fa6ca118-3df0-4b6b-a036-4c70544500e3",
270
+ "metadata": {},
271
+ "outputs": [
272
+ {
273
+ "data": {
274
+ "text/plain": [
275
+ "Dataset({\n",
276
+ " features: ['file', 'audio', 'label', 'is_unknown', 'speaker_id', 'utterance_id'],\n",
277
+ " num_rows: 60973\n",
278
+ "})"
279
+ ]
280
+ },
281
+ "execution_count": 7,
282
+ "metadata": {},
283
+ "output_type": "execute_result"
284
+ }
285
+ ],
286
+ "source": [
287
+ "#raw_dataset_joined = raw_dataset_joined.sort(\"file\")\n",
288
+ "raw_dataset_joined"
289
+ ]
290
+ },
291
+ {
292
+ "cell_type": "code",
293
+ "execution_count": 8,
294
+ "id": "0a56d781-5b5c-4deb-aa4f-c9a1a96ac650",
295
+ "metadata": {},
296
+ "outputs": [
297
+ {
298
+ "data": {
299
+ "application/vnd.jupyter.widget-view+json": {
300
+ "model_id": "4daa94720e334ecd9c1d3cc679bc1ee5",
301
+ "version_major": 2,
302
+ "version_minor": 0
303
+ },
304
+ "text/plain": [
305
+ "Flattening the indices: 0%| | 0/60973 [00:00<?, ? examples/s]"
306
+ ]
307
+ },
308
+ "metadata": {},
309
+ "output_type": "display_data"
310
+ },
311
+ {
312
+ "data": {
313
+ "application/vnd.jupyter.widget-view+json": {
314
+ "model_id": "5a7effce6372433b814701d1a0a51e05",
315
+ "version_major": 2,
316
+ "version_minor": 0
317
+ },
318
+ "text/plain": [
319
+ "Flattening the indices: 0%| | 0/60973 [00:00<?, ? examples/s]"
320
+ ]
321
+ },
322
+ "metadata": {},
323
+ "output_type": "display_data"
324
+ }
325
+ ],
326
+ "source": [
327
+ "complete_dataset = datasets.concatenate_datasets([raw_dataset_joined, joined_dataset_enrichment], axis=1)"
328
+ ]
329
+ },
330
+ {
331
+ "cell_type": "code",
332
+ "execution_count": 9,
333
+ "id": "cb487431-8bc6-483a-bf25-a917278b6781",
334
+ "metadata": {},
335
+ "outputs": [
336
+ {
337
+ "data": {
338
+ "text/plain": [
339
+ "Dataset({\n",
340
+ " features: ['file', 'audio', 'label', 'is_unknown', 'speaker_id', 'utterance_id', 'label_string', 'probability', 'probability_vector', 'prediction', 'prediction_string', 'embedding_reduced', '__index_level_0__'],\n",
341
+ " num_rows: 60973\n",
342
+ "})"
343
+ ]
344
+ },
345
+ "execution_count": 9,
346
+ "metadata": {},
347
+ "output_type": "execute_result"
348
+ }
349
+ ],
350
+ "source": [
351
+ "complete_dataset"
352
+ ]
353
+ },
354
+ {
355
+ "cell_type": "code",
356
+ "execution_count": 11,
357
+ "id": "a11fefeb-9fd1-4500-9b9f-3275207b1cde",
358
+ "metadata": {},
359
+ "outputs": [
360
+ {
361
+ "name": "stderr",
362
+ "output_type": "stream",
363
+ "text": [
364
+ "\n",
365
+ "KeyboardInterrupt\n",
366
+ "\n"
367
+ ]
368
+ }
369
+ ],
370
+ "source": [
371
+ "spotlight.show(\n",
372
+ " complete_dataset,\n",
373
+ " #layout= layout.parse(\"spotlight-layout.json\"),\n",
374
+ " port=7860, \n",
375
+ " host=\"0.0.0.0\",\n",
376
+ " allow_filebrowsing=False \n",
377
+ " )"
378
+ ]
379
+ },
380
+ {
381
+ "cell_type": "code",
382
+ "execution_count": null,
383
+ "id": "f1e38449-7bc1-4ae5-a754-a914a808a534",
384
+ "metadata": {},
385
+ "outputs": [],
386
+ "source": []
387
+ }
388
+ ],
389
+ "metadata": {
390
+ "kernelspec": {
391
+ "display_name": "Python 3 (ipykernel)",
392
+ "language": "python",
393
+ "name": "python3"
394
+ },
395
+ "language_info": {
396
+ "codemirror_mode": {
397
+ "name": "ipython",
398
+ "version": 3
399
+ },
400
+ "file_extension": ".py",
401
+ "mimetype": "text/x-python",
402
+ "name": "python",
403
+ "nbconvert_exporter": "python",
404
+ "pygments_lexer": "ipython3",
405
+ "version": "3.10.12"
406
+ }
407
+ },
408
+ "nbformat": 4,
409
+ "nbformat_minor": 5
410
+ }