File size: 3,543 Bytes
55bd44c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"id": "cf148030-7287-4c9e-ae32-8d1e1c47be30",
"metadata": {},
"outputs": [],
"source": [
"from datasets import Dataset, DatasetDict"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "5161b4ba-e8cf-43e1-b67e-503c29aa4271",
"metadata": {},
"outputs": [],
"source": [
"datasets = DatasetDict.load_from_disk(\"./grouped_dataset\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "15f9d047-ac35-43d7-ab55-9f9afe96dd07",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"DatasetDict({\n",
" train: Dataset({\n",
" features: ['input_ids'],\n",
" num_rows: 86438919\n",
" })\n",
" validation: Dataset({\n",
" features: ['input_ids'],\n",
" num_rows: 4735324\n",
" })\n",
"})"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"datasets"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "d1d1218e-142e-441a-b20d-d300b13b172a",
"metadata": {},
"outputs": [],
"source": [
"train = datasets['train']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9eaddfb1-242f-4a25-8789-efe97b2a5712",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 15,
"id": "8aabb26f-19ca-467a-b383-3a693be70cac",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"86438919\n"
]
}
],
"source": [
"print(len(train))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f3176986-5b34-4ed6-a643-e342db9a2ce8",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 16,
"id": "1205bbef-ba9d-4ddc-af2e-602d56b7dd64",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'input_ids': [256, 3, 20, 18452, 6690, 7757, 1286, 43, 10, 4942, 1286, 80, 12, 4782, 5442, 39, 5385, 33, 4, 5, 3, 2924, 117, 5669, 228, 21, 193, 9030, 511, 24, 11, 5, 665, 165, 4218, 7, 26, 264, 1528, 35, 105, 3, 19653, 12, 9661, 17156, 13955, 4, 132, 5, 611, 959, 961, 146, 6522, 7757, 1286, 89, 7500, 9716, 11, 5, 4868, 107, 13604, 12, 12836, 13368, 11, 611, 959, 4, 3, 69, 99, 12, 13132, 6690, 590, 5, 1803, 1867, 69, 7, 924, 10, 1762, 4, 3, 69, 538, 489, 14, 1149, 16, 3, 11384, 199, 116, 399, 4782, 291, 3, 6, 237, 13, 2629, 3, 8987, 291, 4, 69, 5, 3, 27, 72, 20, 325, 3, 2924, 133, 21, 105, 9030, 10, 1149, 242, 16, 144, 13572, 11, 9, 13401, 20, 7951, 8, 165, 4218, 4, 5, 1910]}\n"
]
}
],
"source": [
"it = iter(train)\n",
"\n",
"print(next(it))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f5d4e8de-419c-4c70-896e-fbd640bb7321",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|