Edward J. Schwartz commited on
Commit
b2537df
1 Parent(s): f35dde1

Update repo

Browse files
Files changed (2) hide show
  1. scripts/data.ipynb +215 -0
  2. scripts/gen-training.py +0 -3
scripts/data.ipynb ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "data": {
10
+ "application/vnd.jupyter.widget-view+json": {
11
+ "model_id": "564cb208df3e42778a1f988e0e077eee",
12
+ "version_major": 2,
13
+ "version_minor": 0
14
+ },
15
+ "text/plain": [
16
+ "Downloading: 0%| | 0.00/938 [00:00<?, ?B/s]"
17
+ ]
18
+ },
19
+ "metadata": {},
20
+ "output_type": "display_data"
21
+ },
22
+ {
23
+ "name": "stderr",
24
+ "output_type": "stream",
25
+ "text": [
26
+ "Using custom data configuration ejschwartz--oo-method-test-new-8eaca399917e96f5\n"
27
+ ]
28
+ },
29
+ {
30
+ "name": "stdout",
31
+ "output_type": "stream",
32
+ "text": [
33
+ "Downloading and preparing dataset csv/default (download: 21.72 MiB, generated: 85.52 MiB, post-processed: Unknown size, total: 107.25 MiB) to /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec...\n"
34
+ ]
35
+ },
36
+ {
37
+ "data": {
38
+ "application/vnd.jupyter.widget-view+json": {
39
+ "model_id": "bb25d525ffb343779353edc479da48c6",
40
+ "version_major": 2,
41
+ "version_minor": 0
42
+ },
43
+ "text/plain": [
44
+ "Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]"
45
+ ]
46
+ },
47
+ "metadata": {},
48
+ "output_type": "display_data"
49
+ },
50
+ {
51
+ "data": {
52
+ "application/vnd.jupyter.widget-view+json": {
53
+ "model_id": "208fc0a559044aab99013e47a81515ad",
54
+ "version_major": 2,
55
+ "version_minor": 0
56
+ },
57
+ "text/plain": [
58
+ "Downloading data: 0%| | 0.00/22.8M [00:00<?, ?B/s]"
59
+ ]
60
+ },
61
+ "metadata": {},
62
+ "output_type": "display_data"
63
+ },
64
+ {
65
+ "data": {
66
+ "application/vnd.jupyter.widget-view+json": {
67
+ "model_id": "19dbc119d6654a21b262770049848aae",
68
+ "version_major": 2,
69
+ "version_minor": 0
70
+ },
71
+ "text/plain": [
72
+ "Extracting data files: 0%| | 0/1 [00:00<?, ?it/s]"
73
+ ]
74
+ },
75
+ "metadata": {},
76
+ "output_type": "display_data"
77
+ },
78
+ {
79
+ "data": {
80
+ "application/vnd.jupyter.widget-view+json": {
81
+ "model_id": "7b9ac6103de94be39157b3de21b49a3f",
82
+ "version_major": 2,
83
+ "version_minor": 0
84
+ },
85
+ "text/plain": [
86
+ "0 tables [00:00, ? tables/s]"
87
+ ]
88
+ },
89
+ "metadata": {},
90
+ "output_type": "display_data"
91
+ },
92
+ {
93
+ "name": "stdout",
94
+ "output_type": "stream",
95
+ "text": [
96
+ "Dataset parquet downloaded and prepared to /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec. Subsequent calls will reuse this data.\n"
97
+ ]
98
+ },
99
+ {
100
+ "data": {
101
+ "application/vnd.jupyter.widget-view+json": {
102
+ "model_id": "f2ab6ee941a24055aa309f89d1cace8d",
103
+ "version_major": 2,
104
+ "version_minor": 0
105
+ },
106
+ "text/plain": [
107
+ " 0%| | 0/1 [00:00<?, ?it/s]"
108
+ ]
109
+ },
110
+ "metadata": {},
111
+ "output_type": "display_data"
112
+ }
113
+ ],
114
+ "source": [
115
+ "import datasets\n",
116
+ "ds = datasets.load_dataset(\"ejschwartz/oo-method-test-new\")"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": 7,
122
+ "metadata": {},
123
+ "outputs": [
124
+ {
125
+ "name": "stderr",
126
+ "output_type": "stream",
127
+ "text": [
128
+ "Loading cached processed dataset at /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec/cache-2cacd54c29fd0da4.arrow\n",
129
+ "Loading cached processed dataset at /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec/cache-aae4742ba8c97557.arrow\n",
130
+ "Loading cached processed dataset at /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec/cache-65c638a5756f05c5.arrow\n",
131
+ "Loading cached processed dataset at /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec/cache-e13e1e6cd866ea19.arrow\n",
132
+ "Loading cached processed dataset at /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec/cache-8a6bb80fc2a77a30.arrow\n"
133
+ ]
134
+ },
135
+ {
136
+ "data": {
137
+ "application/vnd.jupyter.widget-view+json": {
138
+ "model_id": "e7a6a640d0214fec87091e84af1abed9",
139
+ "version_major": 2,
140
+ "version_minor": 0
141
+ },
142
+ "text/plain": [
143
+ " 0%| | 0/84 [00:00<?, ?ba/s]"
144
+ ]
145
+ },
146
+ "metadata": {},
147
+ "output_type": "display_data"
148
+ },
149
+ {
150
+ "data": {
151
+ "application/vnd.jupyter.widget-view+json": {
152
+ "model_id": "bc64279aa0ee488f8d7e22b472524093",
153
+ "version_major": 2,
154
+ "version_minor": 0
155
+ },
156
+ "text/plain": [
157
+ " 0%| | 0/84 [00:00<?, ?ba/s]"
158
+ ]
159
+ },
160
+ "metadata": {},
161
+ "output_type": "display_data"
162
+ },
163
+ {
164
+ "name": "stderr",
165
+ "output_type": "stream",
166
+ "text": [
167
+ "Loading cached processed dataset at /home/eschwartz/.cache/huggingface/datasets/ejschwartz___parquet/ejschwartz--oo-method-test-new-8eaca399917e96f5/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec/cache-5dd37e108f928473.arrow\n"
168
+ ]
169
+ },
170
+ {
171
+ "data": {
172
+ "text/plain": [
173
+ "{'2008': 27454,\n",
174
+ " '2010': 3691,\n",
175
+ " '2012': 5590,\n",
176
+ " '2013': 5908,\n",
177
+ " '2015': 9719,\n",
178
+ " '2017': 9919,\n",
179
+ " '2019': 10534,\n",
180
+ " '2023': 0}"
181
+ ]
182
+ },
183
+ "execution_count": 7,
184
+ "metadata": {},
185
+ "output_type": "execute_result"
186
+ }
187
+ ],
188
+ "source": [
189
+ "{year: len(ds.filter(lambda r: year in r[\"Binary\"])['combined']) for year in [\"2008\", \"2010\", \"2012\", \"2013\", \"2015\", \"2017\", \"2019\", \"2022\"]}"
190
+ ]
191
+ }
192
+ ],
193
+ "metadata": {
194
+ "kernelspec": {
195
+ "display_name": "Python 3",
196
+ "language": "python",
197
+ "name": "python3"
198
+ },
199
+ "language_info": {
200
+ "codemirror_mode": {
201
+ "name": "ipython",
202
+ "version": 3
203
+ },
204
+ "file_extension": ".py",
205
+ "mimetype": "text/x-python",
206
+ "name": "python",
207
+ "nbconvert_exporter": "python",
208
+ "pygments_lexer": "ipython3",
209
+ "version": "3.6.8"
210
+ },
211
+ "orig_nbformat": 4
212
+ },
213
+ "nbformat": 4,
214
+ "nbformat_minor": 2
215
+ }
scripts/gen-training.py CHANGED
@@ -103,9 +103,6 @@ for addr, typ, name in parsed_data:
103
 
104
  df = df.append({'Binary': bname, 'Addr': addr, 'Name': name, 'Type': typ, 'Disassembly': dis}, ignore_index=True)
105
 
106
- if False:
107
- df.to_csv(oname, index=False)
108
-
109
  df.to_csv(oname, index=False)
110
 
111
  #with open(jname, "w") as f:
 
103
 
104
  df = df.append({'Binary': bname, 'Addr': addr, 'Name': name, 'Type': typ, 'Disassembly': dis}, ignore_index=True)
105
 
 
 
 
106
  df.to_csv(oname, index=False)
107
 
108
  #with open(jname, "w") as f: