Racoci commited on
Commit
2eeee0c
1 Parent(s): 439e5fc

Upload LICENSE file and notebook used to upload the dataset

Browse files
Files changed (2) hide show
  1. LICENSE +403 -0
  2. process_coraa.ipynb +207 -0
LICENSE ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Attribution-NonCommercial-NoDerivatives 4.0 International
3
+
4
+ =======================================================================
5
+
6
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
7
+ does not provide legal services or legal advice. Distribution of
8
+ Creative Commons public licenses does not create a lawyer-client or
9
+ other relationship. Creative Commons makes its licenses and related
10
+ information available on an "as-is" basis. Creative Commons gives no
11
+ warranties regarding its licenses, any material licensed under their
12
+ terms and conditions, or any related information. Creative Commons
13
+ disclaims all liability for damages resulting from their use to the
14
+ fullest extent possible.
15
+
16
+ Using Creative Commons Public Licenses
17
+
18
+ Creative Commons public licenses provide a standard set of terms and
19
+ conditions that creators and other rights holders may use to share
20
+ original works of authorship and other material subject to copyright
21
+ and certain other rights specified in the public license below. The
22
+ following considerations are for informational purposes only, are not
23
+ exhaustive, and do not form part of our licenses.
24
+
25
+ Considerations for licensors: Our public licenses are
26
+ intended for use by those authorized to give the public
27
+ permission to use material in ways otherwise restricted by
28
+ copyright and certain other rights. Our licenses are
29
+ irrevocable. Licensors should read and understand the terms
30
+ and conditions of the license they choose before applying it.
31
+ Licensors should also secure all rights necessary before
32
+ applying our licenses so that the public can reuse the
33
+ material as expected. Licensors should clearly mark any
34
+ material not subject to the license. This includes other CC-
35
+ licensed material, or material used under an exception or
36
+ limitation to copyright. More considerations for licensors:
37
+ wiki.creativecommons.org/Considerations_for_licensors
38
+
39
+ Considerations for the public: By using one of our public
40
+ licenses, a licensor grants the public permission to use the
41
+ licensed material under specified terms and conditions. If
42
+ the licensor's permission is not necessary for any reason--for
43
+ example, because of any applicable exception or limitation to
44
+ copyright--then that use is not regulated by the license. Our
45
+ licenses grant only permissions under copyright and certain
46
+ other rights that a licensor has authority to grant. Use of
47
+ the licensed material may still be restricted for other
48
+ reasons, including because others have copyright or other
49
+ rights in the material. A licensor may make special requests,
50
+ such as asking that all changes be marked or described.
51
+ Although not required by our licenses, you are encouraged to
52
+ respect those requests where reasonable. More considerations
53
+ for the public:
54
+ wiki.creativecommons.org/Considerations_for_licensees
55
+
56
+ =======================================================================
57
+
58
+ Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
59
+ International Public License
60
+
61
+ By exercising the Licensed Rights (defined below), You accept and agree
62
+ to be bound by the terms and conditions of this Creative Commons
63
+ Attribution-NonCommercial-NoDerivatives 4.0 International Public
64
+ License ("Public License"). To the extent this Public License may be
65
+ interpreted as a contract, You are granted the Licensed Rights in
66
+ consideration of Your acceptance of these terms and conditions, and the
67
+ Licensor grants You such rights in consideration of benefits the
68
+ Licensor receives from making the Licensed Material available under
69
+ these terms and conditions.
70
+
71
+
72
+ Section 1 -- Definitions.
73
+
74
+ a. Adapted Material means material subject to Copyright and Similar
75
+ Rights that is derived from or based upon the Licensed Material
76
+ and in which the Licensed Material is translated, altered,
77
+ arranged, transformed, or otherwise modified in a manner requiring
78
+ permission under the Copyright and Similar Rights held by the
79
+ Licensor. For purposes of this Public License, where the Licensed
80
+ Material is a musical work, performance, or sound recording,
81
+ Adapted Material is always produced where the Licensed Material is
82
+ synched in timed relation with a moving image.
83
+
84
+ b. Copyright and Similar Rights means copyright and/or similar rights
85
+ closely related to copyright including, without limitation,
86
+ performance, broadcast, sound recording, and Sui Generis Database
87
+ Rights, without regard to how the rights are labeled or
88
+ categorized. For purposes of this Public License, the rights
89
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
90
+ Rights.
91
+
92
+ c. Effective Technological Measures means those measures that, in the
93
+ absence of proper authority, may not be circumvented under laws
94
+ fulfilling obligations under Article 11 of the WIPO Copyright
95
+ Treaty adopted on December 20, 1996, and/or similar international
96
+ agreements.
97
+
98
+ d. Exceptions and Limitations means fair use, fair dealing, and/or
99
+ any other exception or limitation to Copyright and Similar Rights
100
+ that applies to Your use of the Licensed Material.
101
+
102
+ e. Licensed Material means the artistic or literary work, database,
103
+ or other material to which the Licensor applied this Public
104
+ License.
105
+
106
+ f. Licensed Rights means the rights granted to You subject to the
107
+ terms and conditions of this Public License, which are limited to
108
+ all Copyright and Similar Rights that apply to Your use of the
109
+ Licensed Material and that the Licensor has authority to license.
110
+
111
+ g. Licensor means the individual(s) or entity(ies) granting rights
112
+ under this Public License.
113
+
114
+ h. NonCommercial means not primarily intended for or directed towards
115
+ commercial advantage or monetary compensation. For purposes of
116
+ this Public License, the exchange of the Licensed Material for
117
+ other material subject to Copyright and Similar Rights by digital
118
+ file-sharing or similar means is NonCommercial provided there is
119
+ no payment of monetary compensation in connection with the
120
+ exchange.
121
+
122
+ i. Share means to provide material to the public by any means or
123
+ process that requires permission under the Licensed Rights, such
124
+ as reproduction, public display, public performance, distribution,
125
+ dissemination, communication, or importation, and to make material
126
+ available to the public including in ways that members of the
127
+ public may access the material from a place and at a time
128
+ individually chosen by them.
129
+
130
+ j. Sui Generis Database Rights means rights other than copyright
131
+ resulting from Directive 96/9/EC of the European Parliament and of
132
+ the Council of 11 March 1996 on the legal protection of databases,
133
+ as amended and/or succeeded, as well as other essentially
134
+ equivalent rights anywhere in the world.
135
+
136
+ k. You means the individual or entity exercising the Licensed Rights
137
+ under this Public License. Your has a corresponding meaning.
138
+
139
+
140
+ Section 2 -- Scope.
141
+
142
+ a. License grant.
143
+
144
+ 1. Subject to the terms and conditions of this Public License,
145
+ the Licensor hereby grants You a worldwide, royalty-free,
146
+ non-sublicensable, non-exclusive, irrevocable license to
147
+ exercise the Licensed Rights in the Licensed Material to:
148
+
149
+ a. reproduce and Share the Licensed Material, in whole or
150
+ in part, for NonCommercial purposes only; and
151
+
152
+ b. produce and reproduce, but not Share, Adapted Material
153
+ for NonCommercial purposes only.
154
+
155
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
156
+ Exceptions and Limitations apply to Your use, this Public
157
+ License does not apply, and You do not need to comply with
158
+ its terms and conditions.
159
+
160
+ 3. Term. The term of this Public License is specified in Section
161
+ 6(a).
162
+
163
+ 4. Media and formats; technical modifications allowed. The
164
+ Licensor authorizes You to exercise the Licensed Rights in
165
+ all media and formats whether now known or hereafter created,
166
+ and to make technical modifications necessary to do so. The
167
+ Licensor waives and/or agrees not to assert any right or
168
+ authority to forbid You from making technical modifications
169
+ necessary to exercise the Licensed Rights, including
170
+ technical modifications necessary to circumvent Effective
171
+ Technological Measures. For purposes of this Public License,
172
+ simply making modifications authorized by this Section 2(a)
173
+ (4) never produces Adapted Material.
174
+
175
+ 5. Downstream recipients.
176
+
177
+ a. Offer from the Licensor -- Licensed Material. Every
178
+ recipient of the Licensed Material automatically
179
+ receives an offer from the Licensor to exercise the
180
+ Licensed Rights under the terms and conditions of this
181
+ Public License.
182
+
183
+ b. No downstream restrictions. You may not offer or impose
184
+ any additional or different terms or conditions on, or
185
+ apply any Effective Technological Measures to, the
186
+ Licensed Material if doing so restricts exercise of the
187
+ Licensed Rights by any recipient of the Licensed
188
+ Material.
189
+
190
+ 6. No endorsement. Nothing in this Public License constitutes or
191
+ may be construed as permission to assert or imply that You
192
+ are, or that Your use of the Licensed Material is, connected
193
+ with, or sponsored, endorsed, or granted official status by,
194
+ the Licensor or others designated to receive attribution as
195
+ provided in Section 3(a)(1)(A)(i).
196
+
197
+ b. Other rights.
198
+
199
+ 1. Moral rights, such as the right of integrity, are not
200
+ licensed under this Public License, nor are publicity,
201
+ privacy, and/or other similar personality rights; however, to
202
+ the extent possible, the Licensor waives and/or agrees not to
203
+ assert any such rights held by the Licensor to the limited
204
+ extent necessary to allow You to exercise the Licensed
205
+ Rights, but not otherwise.
206
+
207
+ 2. Patent and trademark rights are not licensed under this
208
+ Public License.
209
+
210
+ 3. To the extent possible, the Licensor waives any right to
211
+ collect royalties from You for the exercise of the Licensed
212
+ Rights, whether directly or through a collecting society
213
+ under any voluntary or waivable statutory or compulsory
214
+ licensing scheme. In all other cases the Licensor expressly
215
+ reserves any right to collect such royalties, including when
216
+ the Licensed Material is used other than for NonCommercial
217
+ purposes.
218
+
219
+
220
+ Section 3 -- License Conditions.
221
+
222
+ Your exercise of the Licensed Rights is expressly made subject to the
223
+ following conditions.
224
+
225
+ a. Attribution.
226
+
227
+ 1. If You Share the Licensed Material, You must:
228
+
229
+ a. retain the following if it is supplied by the Licensor
230
+ with the Licensed Material:
231
+
232
+ i. identification of the creator(s) of the Licensed
233
+ Material and any others designated to receive
234
+ attribution, in any reasonable manner requested by
235
+ the Licensor (including by pseudonym if
236
+ designated);
237
+
238
+ ii. a copyright notice;
239
+
240
+ iii. a notice that refers to this Public License;
241
+
242
+ iv. a notice that refers to the disclaimer of
243
+ warranties;
244
+
245
+ v. a URI or hyperlink to the Licensed Material to the
246
+ extent reasonably practicable;
247
+
248
+ b. indicate if You modified the Licensed Material and
249
+ retain an indication of any previous modifications; and
250
+
251
+ c. indicate the Licensed Material is licensed under this
252
+ Public License, and include the text of, or the URI or
253
+ hyperlink to, this Public License.
254
+
255
+ For the avoidance of doubt, You do not have permission under
256
+ this Public License to Share Adapted Material.
257
+
258
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
259
+ reasonable manner based on the medium, means, and context in
260
+ which You Share the Licensed Material. For example, it may be
261
+ reasonable to satisfy the conditions by providing a URI or
262
+ hyperlink to a resource that includes the required
263
+ information.
264
+
265
+ 3. If requested by the Licensor, You must remove any of the
266
+ information required by Section 3(a)(1)(A) to the extent
267
+ reasonably practicable.
268
+
269
+
270
+ Section 4 -- Sui Generis Database Rights.
271
+
272
+ Where the Licensed Rights include Sui Generis Database Rights that
273
+ apply to Your use of the Licensed Material:
274
+
275
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
276
+ to extract, reuse, reproduce, and Share all or a substantial
277
+ portion of the contents of the database for NonCommercial purposes
278
+ only and provided You do not Share Adapted Material;
279
+
280
+ b. if You include all or a substantial portion of the database
281
+ contents in a database in which You have Sui Generis Database
282
+ Rights, then the database in which You have Sui Generis Database
283
+ Rights (but not its individual contents) is Adapted Material; and
284
+
285
+ c. You must comply with the conditions in Section 3(a) if You Share
286
+ all or a substantial portion of the contents of the database.
287
+
288
+ For the avoidance of doubt, this Section 4 supplements and does not
289
+ replace Your obligations under this Public License where the Licensed
290
+ Rights include other Copyright and Similar Rights.
291
+
292
+
293
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
294
+
295
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
296
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
297
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
298
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
299
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
300
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
301
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
302
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
303
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
304
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
305
+
306
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
307
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
308
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
309
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
310
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
311
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
312
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
313
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
314
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
315
+
316
+ c. The disclaimer of warranties and limitation of liability provided
317
+ above shall be interpreted in a manner that, to the extent
318
+ possible, most closely approximates an absolute disclaimer and
319
+ waiver of all liability.
320
+
321
+
322
+ Section 6 -- Term and Termination.
323
+
324
+ a. This Public License applies for the term of the Copyright and
325
+ Similar Rights licensed here. However, if You fail to comply with
326
+ this Public License, then Your rights under this Public License
327
+ terminate automatically.
328
+
329
+ b. Where Your right to use the Licensed Material has terminated under
330
+ Section 6(a), it reinstates:
331
+
332
+ 1. automatically as of the date the violation is cured, provided
333
+ it is cured within 30 days of Your discovery of the
334
+ violation; or
335
+
336
+ 2. upon express reinstatement by the Licensor.
337
+
338
+ For the avoidance of doubt, this Section 6(b) does not affect any
339
+ right the Licensor may have to seek remedies for Your violations
340
+ of this Public License.
341
+
342
+ c. For the avoidance of doubt, the Licensor may also offer the
343
+ Licensed Material under separate terms or conditions or stop
344
+ distributing the Licensed Material at any time; however, doing so
345
+ will not terminate this Public License.
346
+
347
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
348
+ License.
349
+
350
+
351
+ Section 7 -- Other Terms and Conditions.
352
+
353
+ a. The Licensor shall not be bound by any additional or different
354
+ terms or conditions communicated by You unless expressly agreed.
355
+
356
+ b. Any arrangements, understandings, or agreements regarding the
357
+ Licensed Material not stated herein are separate from and
358
+ independent of the terms and conditions of this Public License.
359
+
360
+
361
+ Section 8 -- Interpretation.
362
+
363
+ a. For the avoidance of doubt, this Public License does not, and
364
+ shall not be interpreted to, reduce, limit, restrict, or impose
365
+ conditions on any use of the Licensed Material that could lawfully
366
+ be made without permission under this Public License.
367
+
368
+ b. To the extent possible, if any provision of this Public License is
369
+ deemed unenforceable, it shall be automatically reformed to the
370
+ minimum extent necessary to make it enforceable. If the provision
371
+ cannot be reformed, it shall be severed from this Public License
372
+ without affecting the enforceability of the remaining terms and
373
+ conditions.
374
+
375
+ c. No term or condition of this Public License will be waived and no
376
+ failure to comply consented to unless expressly agreed to by the
377
+ Licensor.
378
+
379
+ d. Nothing in this Public License constitutes or may be interpreted
380
+ as a limitation upon, or waiver of, any privileges and immunities
381
+ that apply to the Licensor or You, including from the legal
382
+ processes of any jurisdiction or authority.
383
+
384
+ =======================================================================
385
+
386
+ Creative Commons is not a party to its public
387
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
388
+ its public licenses to material it publishes and in those instances
389
+ will be considered the “Licensor.” The text of the Creative Commons
390
+ public licenses is dedicated to the public domain under the CC0 Public
391
+ Domain Dedication. Except for the limited purpose of indicating that
392
+ material is shared under a Creative Commons public license or as
393
+ otherwise permitted by the Creative Commons policies published at
394
+ creativecommons.org/policies, Creative Commons does not authorize the
395
+ use of the trademark "Creative Commons" or any other trademark or logo
396
+ of Creative Commons without its prior written consent including,
397
+ without limitation, in connection with any unauthorized modifications
398
+ to any of its public licenses or any other arrangements,
399
+ understandings, or agreements concerning use of licensed material. For
400
+ the avoidance of doubt, this paragraph does not form part of the
401
+ public licenses.
402
+
403
+ Creative Commons may be contacted at creativecommons.org.
process_coraa.ipynb ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stderr",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "/home/escher/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
13
+ " from .autonotebook import tqdm as notebook_tqdm\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "# pip install librosa soundfile datasets transformers pandas\n",
19
+ "\n",
20
+ "import os\n",
21
+ "import pandas as pd\n",
22
+ "from datasets import Dataset, DatasetDict, load_dataset, Audio\n",
23
+ "\n",
24
+ "# Define the paths to your data\n",
25
+ "audio_folder = \".\"\n",
26
+ "metadata_files = {\n",
27
+ " \"train\": \"./metadata_train_final.csv\",\n",
28
+ " \"dev\": \"./metadata_dev_final.csv\",\n",
29
+ " \"test\": \"./metadata_test_final.csv\"\n",
30
+ "}\n",
31
+ "\n",
32
+ "# Function to load and process each split\n",
33
+ "def load_and_process_split(split_name, metadata_file):\n",
34
+ " metadata = pd.read_csv(metadata_file)\n",
35
+ " dataset = Dataset.from_pandas(metadata)\n",
36
+ " dataset = dataset.map(lambda row: {\"audio\": os.path.join(audio_folder, row[\"file_path\"])})\n",
37
+ " dataset = dataset.cast_column(\"audio\", Audio())\n",
38
+ " return dataset\n"
39
+ ]
40
+ },
41
+ {
42
+ "cell_type": "code",
43
+ "execution_count": 2,
44
+ "metadata": {},
45
+ "outputs": [
46
+ {
47
+ "name": "stderr",
48
+ "output_type": "stream",
49
+ "text": [
50
+ "Map: 100%|██████████| 382258/382258 [02:35<00:00, 2456.10 examples/s]\n",
51
+ "Map: 100%|██████████| 7522/7522 [00:03<00:00, 2342.43 examples/s]\n",
52
+ "Map: 100%|██████████| 12676/12676 [00:05<00:00, 2413.03 examples/s]\n",
53
+ "Saving the dataset (125/125 shards): 100%|██████████| 382258/382258 [15:59<00:00, 398.47 examples/s]\n",
54
+ "Saving the dataset (3/3 shards): 100%|██████████| 7522/7522 [00:44<00:00, 169.61 examples/s]\n",
55
+ "Saving the dataset (5/5 shards): 100%|██████████| 12676/12676 [00:44<00:00, 282.87 examples/s]\n"
56
+ ]
57
+ }
58
+ ],
59
+ "source": [
60
+ "# Create a DatasetDict\n",
61
+ "dataset_dict = DatasetDict({\n",
62
+ " key: load_and_process_split(key, metadata_files[key])\n",
63
+ " for key in metadata_files\n",
64
+ "})\n",
65
+ "\n",
66
+ "dataset_dict.save_to_disk(\"processed_coraa\")"
67
+ ]
68
+ },
69
+ {
70
+ "cell_type": "code",
71
+ "execution_count": 2,
72
+ "metadata": {},
73
+ "outputs": [
74
+ {
75
+ "name": "stderr",
76
+ "output_type": "stream",
77
+ "text": [
78
+ "/home/escher/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
79
+ " from .autonotebook import tqdm as notebook_tqdm\n"
80
+ ]
81
+ },
82
+ {
83
+ "name": "stdout",
84
+ "output_type": "stream",
85
+ "text": [
86
+ "DatasetDict({\n",
87
+ " train: Dataset({\n",
88
+ " features: ['file_path', 'task', 'variety', 'dataset', 'accent', 'speech_genre', 'speech_style', 'up_votes', 'down_votes', 'votes_for_hesitation', 'votes_for_filled_pause', 'votes_for_noise_or_low_voice', 'votes_for_second_voice', 'votes_for_no_identified_problem', 'text', 'audio'],\n",
89
+ " num_rows: 382258\n",
90
+ " })\n",
91
+ " dev: Dataset({\n",
92
+ " features: ['file_path', 'task', 'variety', 'dataset', 'accent', 'speech_genre', 'speech_style', 'up_votes', 'down_votes', 'votes_for_hesitation', 'votes_for_filled_pause', 'votes_for_noise_or_low_voice', 'votes_for_second_voice', 'votes_for_no_identified_problem', 'text', 'audio'],\n",
93
+ " num_rows: 7522\n",
94
+ " })\n",
95
+ " test: Dataset({\n",
96
+ " features: ['file_path', 'task', 'variety', 'dataset', 'accent', 'speech_genre', 'speech_style', 'up_votes', 'down_votes', 'votes_for_hesitation', 'votes_for_filled_pause', 'votes_for_noise_or_low_voice', 'votes_for_second_voice', 'votes_for_no_identified_problem', 'text', 'audio'],\n",
97
+ " num_rows: 12676\n",
98
+ " })\n",
99
+ "})\n"
100
+ ]
101
+ }
102
+ ],
103
+ "source": [
104
+ "# After running the script, verify the structure and contents of the processed dataset:\n",
105
+ "from datasets import load_from_disk\n",
106
+ "\n",
107
+ "# Load the processed dataset\n",
108
+ "dataset_dict = load_from_disk(\"processed_coraa\")\n",
109
+ "\n",
110
+ "# Check the dataset structure\n",
111
+ "print(dataset_dict)\n"
112
+ ]
113
+ },
114
+ {
115
+ "cell_type": "code",
116
+ "execution_count": 1,
117
+ "metadata": {},
118
+ "outputs": [
119
+ {
120
+ "ename": "NameError",
121
+ "evalue": "name 'dataset_dict' is not defined",
122
+ "output_type": "error",
123
+ "traceback": [
124
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
125
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
126
+ "Cell \u001b[0;32mIn[1], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Check a sample from each split\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mdataset_dict\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdev\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m])\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(dataset_dict[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtest\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m])\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# Ensure the audio files are correctly loaded and playable:\u001b[39;00m\n",
127
+ "\u001b[0;31mNameError\u001b[0m: name 'dataset_dict' is not defined"
128
+ ]
129
+ }
130
+ ],
131
+ "source": [
132
+ "# Check a sample from each split\n",
133
+ "print(dataset_dict[\"dev\"][0])\n",
134
+ "print(dataset_dict[\"test\"][0])\n",
135
+ "\n",
136
+ "# Ensure the audio files are correctly loaded and playable:\n",
137
+ "import IPython.display as ipd\n",
138
+ "\n",
139
+ "# Display the first audio sample\n",
140
+ "ipd.Audio(dataset_dict[\"train\"][0][\"audio\"][\"array\"], rate=dataset_dict[\"train\"][0][\"audio\"][\"sampling_rate\"])"
141
+ ]
142
+ },
143
+ {
144
+ "cell_type": "code",
145
+ "execution_count": 7,
146
+ "metadata": {},
147
+ "outputs": [],
148
+ "source": [
149
+ "import os\n",
150
+ "\n",
151
+ "# Get the token from the environment\n",
152
+ "token = os.getenv(\"HF_TOKEN\")"
153
+ ]
154
+ },
155
+ {
156
+ "cell_type": "code",
157
+ "execution_count": 9,
158
+ "metadata": {},
159
+ "outputs": [
160
+ {
161
+ "ename": "HfHubHTTPError",
162
+ "evalue": "401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create (Request ID: Root=1-665a64d7-7c65f3ac5c9f8e342ff9032f;a3372b6f-f746-4fe0-81ac-d5965ae1a6d6)\n\nInvalid username or password.",
163
+ "output_type": "error",
164
+ "traceback": [
165
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
166
+ "\u001b[0;31mHTTPError\u001b[0m Traceback (most recent call last)",
167
+ "File \u001b[0;32m~/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py:304\u001b[0m, in \u001b[0;36mhf_raise_for_status\u001b[0;34m(response, endpoint_name)\u001b[0m\n\u001b[1;32m 303\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 304\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 305\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m HTTPError \u001b[38;5;28;01mas\u001b[39;00m e:\n",
168
+ "File \u001b[0;32m~/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/requests/models.py:1024\u001b[0m, in \u001b[0;36mResponse.raise_for_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1023\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[0;32m-> 1024\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m)\n",
169
+ "\u001b[0;31mHTTPError\u001b[0m: 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create",
170
+ "\nThe above exception was the direct cause of the following exception:\n",
171
+ "\u001b[0;31mHfHubHTTPError\u001b[0m Traceback (most recent call last)",
172
+ "Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdataset_dict\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpush_to_hub\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mgabrielrstan/CORAA-v1.1\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m)\u001b[49m\n",
173
+ "File \u001b[0;32m~/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/datasets/dataset_dict.py:1703\u001b[0m, in \u001b[0;36mDatasetDict.push_to_hub\u001b[0;34m(self, repo_id, config_name, set_default, data_dir, commit_message, commit_description, private, token, revision, branch, create_pr, max_shard_size, num_shards, embed_external_files)\u001b[0m\n\u001b[1;32m 1699\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSplit name should match \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m_split_re\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m but got \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00msplit\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 1701\u001b[0m api \u001b[38;5;241m=\u001b[39m HfApi(endpoint\u001b[38;5;241m=\u001b[39mconfig\u001b[38;5;241m.\u001b[39mHF_ENDPOINT, token\u001b[38;5;241m=\u001b[39mtoken)\n\u001b[0;32m-> 1703\u001b[0m repo_url \u001b[38;5;241m=\u001b[39m \u001b[43mapi\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_repo\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1704\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1705\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1706\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdataset\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1707\u001b[0m \u001b[43m \u001b[49m\u001b[43mprivate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mprivate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1708\u001b[0m \u001b[43m \u001b[49m\u001b[43mexist_ok\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 1709\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1710\u001b[0m repo_id \u001b[38;5;241m=\u001b[39m repo_url\u001b[38;5;241m.\u001b[39mrepo_id\n\u001b[1;32m 1712\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m revision \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
174
+ "File \u001b[0;32m~/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
175
+ "File \u001b[0;32m~/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/huggingface_hub/hf_api.py:3256\u001b[0m, in \u001b[0;36mHfApi.create_repo\u001b[0;34m(self, repo_id, token, private, repo_type, exist_ok, space_sdk, space_hardware, space_storage, space_sleep_time, space_secrets, space_variables)\u001b[0m\n\u001b[1;32m 3253\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[1;32m 3255\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 3256\u001b[0m \u001b[43mhf_raise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43mr\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3257\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m HTTPError \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m 3258\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m exist_ok \u001b[38;5;129;01mand\u001b[39;00m err\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mstatus_code \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m409\u001b[39m:\n\u001b[1;32m 3259\u001b[0m \u001b[38;5;66;03m# Repo already exists and `exist_ok=True`\u001b[39;00m\n",
176
+ "File \u001b[0;32m~/Projects/oficina/CORRA/CORAA-v1.1/.venv/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py:371\u001b[0m, in \u001b[0;36mhf_raise_for_status\u001b[0;34m(response, endpoint_name)\u001b[0m\n\u001b[1;32m 367\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HfHubHTTPError(message, response\u001b[38;5;241m=\u001b[39mresponse) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[1;32m 369\u001b[0m \u001b[38;5;66;03m# Convert `HTTPError` into a `HfHubHTTPError` to display request information\u001b[39;00m\n\u001b[1;32m 370\u001b[0m \u001b[38;5;66;03m# as well (request id and/or server error message)\u001b[39;00m\n\u001b[0;32m--> 371\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HfHubHTTPError(\u001b[38;5;28mstr\u001b[39m(e), response\u001b[38;5;241m=\u001b[39mresponse) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n",
177
+ "\u001b[0;31mHfHubHTTPError\u001b[0m: 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create (Request ID: Root=1-665a64d7-7c65f3ac5c9f8e342ff9032f;a3372b6f-f746-4fe0-81ac-d5965ae1a6d6)\n\nInvalid username or password."
178
+ ]
179
+ }
180
+ ],
181
+ "source": [
182
+ "dataset_dict.push_to_hub(\"Racoci/CORAA-v1.1\", token=token)"
183
+ ]
184
+ }
185
+ ],
186
+ "metadata": {
187
+ "kernelspec": {
188
+ "display_name": ".venv",
189
+ "language": "python",
190
+ "name": "python3"
191
+ },
192
+ "language_info": {
193
+ "codemirror_mode": {
194
+ "name": "ipython",
195
+ "version": 3
196
+ },
197
+ "file_extension": ".py",
198
+ "mimetype": "text/x-python",
199
+ "name": "python",
200
+ "nbconvert_exporter": "python",
201
+ "pygments_lexer": "ipython3",
202
+ "version": "3.10.12"
203
+ }
204
+ },
205
+ "nbformat": 4,
206
+ "nbformat_minor": 2
207
+ }