{ "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 }