Datasets:
Edward J. Schwartz
commited on
Commit
·
2046d8c
1
Parent(s):
b3b7f95
Update import data script
Browse files- scripts/import_data.ipynb +72 -22
scripts/import_data.ipynb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
-
"execution_count":
|
| 6 |
"metadata": {},
|
| 7 |
"outputs": [
|
| 8 |
{
|
|
@@ -11,7 +11,7 @@
|
|
| 11 |
"0"
|
| 12 |
]
|
| 13 |
},
|
| 14 |
-
"execution_count":
|
| 15 |
"metadata": {},
|
| 16 |
"output_type": "execute_result"
|
| 17 |
}
|
|
@@ -19,20 +19,23 @@
|
|
| 19 |
"source": [
|
| 20 |
"import datasets\n",
|
| 21 |
"import subprocess\n",
|
|
|
|
|
|
|
|
|
|
| 22 |
"subprocess.check_call(\"rm -rf /tmp/somewhere\", shell=True)\n",
|
| 23 |
"subprocess.check_call(\"mkdir -p /tmp/somewhere\", shell=True)\n",
|
| 24 |
-
"subprocess.check_call(\"find
|
| 25 |
]
|
| 26 |
},
|
| 27 |
{
|
| 28 |
"cell_type": "code",
|
| 29 |
-
"execution_count":
|
| 30 |
"metadata": {},
|
| 31 |
"outputs": [
|
| 32 |
{
|
| 33 |
"data": {
|
| 34 |
"application/vnd.jupyter.widget-view+json": {
|
| 35 |
-
"model_id": "
|
| 36 |
"version_major": 2,
|
| 37 |
"version_minor": 0
|
| 38 |
},
|
|
@@ -47,20 +50,20 @@
|
|
| 47 |
"name": "stderr",
|
| 48 |
"output_type": "stream",
|
| 49 |
"text": [
|
| 50 |
-
"Using custom data configuration default-
|
| 51 |
]
|
| 52 |
},
|
| 53 |
{
|
| 54 |
"name": "stdout",
|
| 55 |
"output_type": "stream",
|
| 56 |
"text": [
|
| 57 |
-
"Downloading and preparing dataset csv/default to /home/eschwartz/.cache/huggingface/datasets/csv/default-
|
| 58 |
]
|
| 59 |
},
|
| 60 |
{
|
| 61 |
"data": {
|
| 62 |
"application/vnd.jupyter.widget-view+json": {
|
| 63 |
-
"model_id": "
|
| 64 |
"version_major": 2,
|
| 65 |
"version_minor": 0
|
| 66 |
},
|
|
@@ -74,7 +77,7 @@
|
|
| 74 |
{
|
| 75 |
"data": {
|
| 76 |
"application/vnd.jupyter.widget-view+json": {
|
| 77 |
-
"model_id": "
|
| 78 |
"version_major": 2,
|
| 79 |
"version_minor": 0
|
| 80 |
},
|
|
@@ -88,7 +91,7 @@
|
|
| 88 |
{
|
| 89 |
"data": {
|
| 90 |
"application/vnd.jupyter.widget-view+json": {
|
| 91 |
-
"model_id": "
|
| 92 |
"version_major": 2,
|
| 93 |
"version_minor": 0
|
| 94 |
},
|
|
@@ -103,13 +106,13 @@
|
|
| 103 |
"name": "stdout",
|
| 104 |
"output_type": "stream",
|
| 105 |
"text": [
|
| 106 |
-
"Dataset csv downloaded and prepared to /home/eschwartz/.cache/huggingface/datasets/csv/default-
|
| 107 |
]
|
| 108 |
},
|
| 109 |
{
|
| 110 |
"data": {
|
| 111 |
"application/vnd.jupyter.widget-view+json": {
|
| 112 |
-
"model_id": "
|
| 113 |
"version_major": 2,
|
| 114 |
"version_minor": 0
|
| 115 |
},
|
|
@@ -123,12 +126,12 @@
|
|
| 123 |
{
|
| 124 |
"data": {
|
| 125 |
"application/vnd.jupyter.widget-view+json": {
|
| 126 |
-
"model_id": "
|
| 127 |
"version_major": 2,
|
| 128 |
"version_minor": 0
|
| 129 |
},
|
| 130 |
"text/plain": [
|
| 131 |
-
"Casting to class labels: 0%| | 0/
|
| 132 |
]
|
| 133 |
},
|
| 134 |
"metadata": {},
|
|
@@ -137,12 +140,12 @@
|
|
| 137 |
{
|
| 138 |
"data": {
|
| 139 |
"application/vnd.jupyter.widget-view+json": {
|
| 140 |
-
"model_id": "
|
| 141 |
"version_major": 2,
|
| 142 |
"version_minor": 0
|
| 143 |
},
|
| 144 |
"text/plain": [
|
| 145 |
-
"Casting the dataset: 0%| | 0/
|
| 146 |
]
|
| 147 |
},
|
| 148 |
"metadata": {},
|
|
@@ -158,16 +161,41 @@
|
|
| 158 |
},
|
| 159 |
{
|
| 160 |
"cell_type": "code",
|
| 161 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
"metadata": {},
|
| 163 |
"outputs": [
|
| 164 |
{
|
| 165 |
"data": {
|
| 166 |
"text/plain": [
|
| 167 |
-
"
|
| 168 |
]
|
| 169 |
},
|
| 170 |
-
"execution_count":
|
| 171 |
"metadata": {},
|
| 172 |
"output_type": "execute_result"
|
| 173 |
}
|
|
@@ -178,11 +206,33 @@
|
|
| 178 |
},
|
| 179 |
{
|
| 180 |
"cell_type": "code",
|
| 181 |
-
"execution_count":
|
| 182 |
"metadata": {},
|
| 183 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
"source": [
|
| 185 |
-
"ds.push_to_hub('ejschwartz/oo-
|
| 186 |
]
|
| 187 |
}
|
| 188 |
],
|
|
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
+
"execution_count": 2,
|
| 6 |
"metadata": {},
|
| 7 |
"outputs": [
|
| 8 |
{
|
|
|
|
| 11 |
"0"
|
| 12 |
]
|
| 13 |
},
|
| 14 |
+
"execution_count": 2,
|
| 15 |
"metadata": {},
|
| 16 |
"output_type": "execute_result"
|
| 17 |
}
|
|
|
|
| 19 |
"source": [
|
| 20 |
"import datasets\n",
|
| 21 |
"import subprocess\n",
|
| 22 |
+
"\n",
|
| 23 |
+
"exepath = \"/home/eschwartz/ooanalyzer-tests/code/testcases/BuildExes\"\n",
|
| 24 |
+
"\n",
|
| 25 |
"subprocess.check_call(\"rm -rf /tmp/somewhere\", shell=True)\n",
|
| 26 |
"subprocess.check_call(\"mkdir -p /tmp/somewhere\", shell=True)\n",
|
| 27 |
+
"subprocess.check_call(f\"find {exepath} -name '*.csv' | tar -T - -c | tar -C /tmp/somewhere -x\", shell=True)"
|
| 28 |
]
|
| 29 |
},
|
| 30 |
{
|
| 31 |
"cell_type": "code",
|
| 32 |
+
"execution_count": 3,
|
| 33 |
"metadata": {},
|
| 34 |
"outputs": [
|
| 35 |
{
|
| 36 |
"data": {
|
| 37 |
"application/vnd.jupyter.widget-view+json": {
|
| 38 |
+
"model_id": "65caf25c8de2403bb5c410f4ed6619d9",
|
| 39 |
"version_major": 2,
|
| 40 |
"version_minor": 0
|
| 41 |
},
|
|
|
|
| 50 |
"name": "stderr",
|
| 51 |
"output_type": "stream",
|
| 52 |
"text": [
|
| 53 |
+
"Using custom data configuration default-d787400fe14ff4a8\n"
|
| 54 |
]
|
| 55 |
},
|
| 56 |
{
|
| 57 |
"name": "stdout",
|
| 58 |
"output_type": "stream",
|
| 59 |
"text": [
|
| 60 |
+
"Downloading and preparing dataset csv/default to /home/eschwartz/.cache/huggingface/datasets/csv/default-d787400fe14ff4a8/0.0.0/652c3096f041ee27b04d2232d41f10547a8fecda3e284a79a0ec4053c916ef7a...\n"
|
| 61 |
]
|
| 62 |
},
|
| 63 |
{
|
| 64 |
"data": {
|
| 65 |
"application/vnd.jupyter.widget-view+json": {
|
| 66 |
+
"model_id": "44a0e4c531f644558028cc4ae4f55e8d",
|
| 67 |
"version_major": 2,
|
| 68 |
"version_minor": 0
|
| 69 |
},
|
|
|
|
| 77 |
{
|
| 78 |
"data": {
|
| 79 |
"application/vnd.jupyter.widget-view+json": {
|
| 80 |
+
"model_id": "7120dbcac25d4283921a5d426c95bd48",
|
| 81 |
"version_major": 2,
|
| 82 |
"version_minor": 0
|
| 83 |
},
|
|
|
|
| 91 |
{
|
| 92 |
"data": {
|
| 93 |
"application/vnd.jupyter.widget-view+json": {
|
| 94 |
+
"model_id": "78149c6900134d2e8aecb4d394c1f10f",
|
| 95 |
"version_major": 2,
|
| 96 |
"version_minor": 0
|
| 97 |
},
|
|
|
|
| 106 |
"name": "stdout",
|
| 107 |
"output_type": "stream",
|
| 108 |
"text": [
|
| 109 |
+
"Dataset csv downloaded and prepared to /home/eschwartz/.cache/huggingface/datasets/csv/default-d787400fe14ff4a8/0.0.0/652c3096f041ee27b04d2232d41f10547a8fecda3e284a79a0ec4053c916ef7a. Subsequent calls will reuse this data.\n"
|
| 110 |
]
|
| 111 |
},
|
| 112 |
{
|
| 113 |
"data": {
|
| 114 |
"application/vnd.jupyter.widget-view+json": {
|
| 115 |
+
"model_id": "716e45950be24f5f89a4ab4f72acaf7c",
|
| 116 |
"version_major": 2,
|
| 117 |
"version_minor": 0
|
| 118 |
},
|
|
|
|
| 126 |
{
|
| 127 |
"data": {
|
| 128 |
"application/vnd.jupyter.widget-view+json": {
|
| 129 |
+
"model_id": "af7901f9d08c4d1daace7d31c92c03b8",
|
| 130 |
"version_major": 2,
|
| 131 |
"version_minor": 0
|
| 132 |
},
|
| 133 |
"text/plain": [
|
| 134 |
+
"Casting to class labels: 0%| | 0/3538 [00:00<?, ?ba/s]"
|
| 135 |
]
|
| 136 |
},
|
| 137 |
"metadata": {},
|
|
|
|
| 140 |
{
|
| 141 |
"data": {
|
| 142 |
"application/vnd.jupyter.widget-view+json": {
|
| 143 |
+
"model_id": "342cbe6ab8e34061a2bc7c1edfa875fc",
|
| 144 |
"version_major": 2,
|
| 145 |
"version_minor": 0
|
| 146 |
},
|
| 147 |
"text/plain": [
|
| 148 |
+
"Casting the dataset: 0%| | 0/354 [00:00<?, ?ba/s]"
|
| 149 |
]
|
| 150 |
},
|
| 151 |
"metadata": {},
|
|
|
|
| 161 |
},
|
| 162 |
{
|
| 163 |
"cell_type": "code",
|
| 164 |
+
"execution_count": 4,
|
| 165 |
+
"metadata": {},
|
| 166 |
+
"outputs": [
|
| 167 |
+
{
|
| 168 |
+
"data": {
|
| 169 |
+
"text/plain": [
|
| 170 |
+
"DatasetDict({\n",
|
| 171 |
+
" combined: Dataset({\n",
|
| 172 |
+
" features: ['Binary', 'Addr', 'Name', 'Type', 'Disassembly'],\n",
|
| 173 |
+
" num_rows: 3537794\n",
|
| 174 |
+
" })\n",
|
| 175 |
+
"})"
|
| 176 |
+
]
|
| 177 |
+
},
|
| 178 |
+
"execution_count": 4,
|
| 179 |
+
"metadata": {},
|
| 180 |
+
"output_type": "execute_result"
|
| 181 |
+
}
|
| 182 |
+
],
|
| 183 |
+
"source": [
|
| 184 |
+
"ds"
|
| 185 |
+
]
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"cell_type": "code",
|
| 189 |
+
"execution_count": 5,
|
| 190 |
"metadata": {},
|
| 191 |
"outputs": [
|
| 192 |
{
|
| 193 |
"data": {
|
| 194 |
"text/plain": [
|
| 195 |
+
"3537794"
|
| 196 |
]
|
| 197 |
},
|
| 198 |
+
"execution_count": 5,
|
| 199 |
"metadata": {},
|
| 200 |
"output_type": "execute_result"
|
| 201 |
}
|
|
|
|
| 206 |
},
|
| 207 |
{
|
| 208 |
"cell_type": "code",
|
| 209 |
+
"execution_count": 8,
|
| 210 |
"metadata": {},
|
| 211 |
+
"outputs": [
|
| 212 |
+
{
|
| 213 |
+
"name": "stderr",
|
| 214 |
+
"output_type": "stream",
|
| 215 |
+
"text": [
|
| 216 |
+
"Pushing split combined to the Hub.\n"
|
| 217 |
+
]
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"data": {
|
| 221 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 222 |
+
"model_id": "ad1a75d926bf4dc4aaf06fd29f8ed9b6",
|
| 223 |
+
"version_major": 2,
|
| 224 |
+
"version_minor": 0
|
| 225 |
+
},
|
| 226 |
+
"text/plain": [
|
| 227 |
+
"Pushing dataset shards to the dataset hub: 0%| | 0/13 [00:00<?, ?it/s]"
|
| 228 |
+
]
|
| 229 |
+
},
|
| 230 |
+
"metadata": {},
|
| 231 |
+
"output_type": "display_data"
|
| 232 |
+
}
|
| 233 |
+
],
|
| 234 |
"source": [
|
| 235 |
+
"ds.push_to_hub('ejschwartz/oo-method-test')"
|
| 236 |
]
|
| 237 |
}
|
| 238 |
],
|