huseinzol05 commited on
Commit
2fcfa74
β€’
1 Parent(s): 66a8214

Upload 2 files

Browse files
filter-aya-dataset.ipynb ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "85d9c344",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "data": {
11
+ "application/vnd.jupyter.widget-view+json": {
12
+ "model_id": "72bc5f455b2143dd90cf810189aee21c",
13
+ "version_major": 2,
14
+ "version_minor": 0
15
+ },
16
+ "text/plain": [
17
+ "Downloading readme: 0%| | 0.00/13.3k [00:00<?, ?B/s]"
18
+ ]
19
+ },
20
+ "metadata": {},
21
+ "output_type": "display_data"
22
+ },
23
+ {
24
+ "data": {
25
+ "application/vnd.jupyter.widget-view+json": {
26
+ "model_id": "12c524f78a4a4570b80b72badf142790",
27
+ "version_major": 2,
28
+ "version_minor": 0
29
+ },
30
+ "text/plain": [
31
+ "Downloading data files: 0%| | 0/2 [00:00<?, ?it/s]"
32
+ ]
33
+ },
34
+ "metadata": {},
35
+ "output_type": "display_data"
36
+ },
37
+ {
38
+ "data": {
39
+ "application/vnd.jupyter.widget-view+json": {
40
+ "model_id": "9f6b9877390042639aae89118307a057",
41
+ "version_major": 2,
42
+ "version_minor": 0
43
+ },
44
+ "text/plain": [
45
+ "Downloading data: 0%| | 0.00/137M [00:00<?, ?B/s]"
46
+ ]
47
+ },
48
+ "metadata": {},
49
+ "output_type": "display_data"
50
+ },
51
+ {
52
+ "data": {
53
+ "application/vnd.jupyter.widget-view+json": {
54
+ "model_id": "8f7accf7b9714eeea410350ba9108ef0",
55
+ "version_major": 2,
56
+ "version_minor": 0
57
+ },
58
+ "text/plain": [
59
+ "Downloading data: 0%| | 0.00/978k [00:00<?, ?B/s]"
60
+ ]
61
+ },
62
+ "metadata": {},
63
+ "output_type": "display_data"
64
+ },
65
+ {
66
+ "data": {
67
+ "application/vnd.jupyter.widget-view+json": {
68
+ "model_id": "2e237b82f21b43bfaae03fd8d5117434",
69
+ "version_major": 2,
70
+ "version_minor": 0
71
+ },
72
+ "text/plain": [
73
+ "Extracting data files: 0%| | 0/2 [00:00<?, ?it/s]"
74
+ ]
75
+ },
76
+ "metadata": {},
77
+ "output_type": "display_data"
78
+ },
79
+ {
80
+ "data": {
81
+ "application/vnd.jupyter.widget-view+json": {
82
+ "model_id": "79fd626291db4283863f4c2ecc0340aa",
83
+ "version_major": 2,
84
+ "version_minor": 0
85
+ },
86
+ "text/plain": [
87
+ "Generating train split: 0%| | 0/202364 [00:00<?, ? examples/s]"
88
+ ]
89
+ },
90
+ "metadata": {},
91
+ "output_type": "display_data"
92
+ },
93
+ {
94
+ "data": {
95
+ "application/vnd.jupyter.widget-view+json": {
96
+ "model_id": "a17e2606490041e7ab0c5687a575c675",
97
+ "version_major": 2,
98
+ "version_minor": 0
99
+ },
100
+ "text/plain": [
101
+ "Generating test split: 0%| | 0/1750 [00:00<?, ? examples/s]"
102
+ ]
103
+ },
104
+ "metadata": {},
105
+ "output_type": "display_data"
106
+ }
107
+ ],
108
+ "source": [
109
+ "from datasets import load_dataset\n",
110
+ "\n",
111
+ "dataset = load_dataset(\"CohereForAI/aya_dataset\")"
112
+ ]
113
+ },
114
+ {
115
+ "cell_type": "code",
116
+ "execution_count": 11,
117
+ "id": "ece918a9",
118
+ "metadata": {},
119
+ "outputs": [
120
+ {
121
+ "name": "stderr",
122
+ "output_type": "stream",
123
+ "text": [
124
+ "100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 202364/202364 [00:09<00:00, 21823.15it/s]\n"
125
+ ]
126
+ }
127
+ ],
128
+ "source": [
129
+ "from tqdm import tqdm\n",
130
+ "\n",
131
+ "filtered = []\n",
132
+ "for d in tqdm(dataset['train']):\n",
133
+ " if d['language_code'] == 'zsm':\n",
134
+ " filtered.append(d)"
135
+ ]
136
+ },
137
+ {
138
+ "cell_type": "code",
139
+ "execution_count": 22,
140
+ "id": "57ea1626",
141
+ "metadata": {},
142
+ "outputs": [
143
+ {
144
+ "data": {
145
+ "text/plain": [
146
+ "10073"
147
+ ]
148
+ },
149
+ "execution_count": 22,
150
+ "metadata": {},
151
+ "output_type": "execute_result"
152
+ }
153
+ ],
154
+ "source": [
155
+ "len(filtered)"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "code",
160
+ "execution_count": 24,
161
+ "id": "754b42b7",
162
+ "metadata": {},
163
+ "outputs": [],
164
+ "source": [
165
+ "import json\n",
166
+ "\n",
167
+ "with open('filtered-aya_dataset-zsm.jsonl', 'w') as fopen:\n",
168
+ " for d in filtered:\n",
169
+ " fopen.write(f'{json.dumps(d)}\\n')"
170
+ ]
171
+ }
172
+ ],
173
+ "metadata": {
174
+ "kernelspec": {
175
+ "display_name": "Python 3 (ipykernel)",
176
+ "language": "python",
177
+ "name": "python3"
178
+ },
179
+ "language_info": {
180
+ "codemirror_mode": {
181
+ "name": "ipython",
182
+ "version": 3
183
+ },
184
+ "file_extension": ".py",
185
+ "mimetype": "text/x-python",
186
+ "name": "python",
187
+ "nbconvert_exporter": "python",
188
+ "pygments_lexer": "ipython3",
189
+ "version": "3.10.12"
190
+ }
191
+ },
192
+ "nbformat": 4,
193
+ "nbformat_minor": 5
194
+ }
filtered-aya_dataset-zsm.jsonl ADDED
The diff for this file is too large to render. See raw diff