{ "cells": [ { "cell_type": "code", <<<<<<< HEAD "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "from datasets import load_dataset\n", "import json" ======= "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from datasets import load_dataset" >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 ] }, { "cell_type": "code", <<<<<<< HEAD "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "for year in [2022,2023]:\n", " for subject in [\"math\"]:\n", " file_orig=f\"./data/json/{year}/{subject}_v1.json\"\n", " file_dest=f\"./data/json/{year}/{subject}.json\"\n", " with open(file_dest,\"w\") as f:\n", " for line in open(file_orig,\"r\"):\n", " data = json.loads(line)\n", " if \"incomplete\" not in data:\n", " data[\"incomplete\"] = False\n", " linewrite=json.dumps(data,ensure_ascii=False)\n", " f.write(linewrite+\"\\n\")" ] }, { "cell_type": "code", "execution_count": 22, ======= "execution_count": 4, >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { <<<<<<< HEAD "model_id": "462231fd51404fd290bffe90a8c0b158", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Downloading data files: 0%| | 0/2 [00:00>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 "version_major": 2, "version_minor": 0 }, "text/plain": [ "Generating 2023_math split: 0 examples [00:00, ? examples/s]" ] }, "metadata": {}, "output_type": "display_data" <<<<<<< HEAD } ], "source": [ "dataset=load_dataset(\"json\",data_files={\"2022_math\":\"./data/json/2022/math.json\",\n", " \"2023_math\":\"./data/json/2023/math.json\"})" ======= }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "a3015bdd603e44c789b8347863bb94c8", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Generating 2024_math split: 0 examples [00:00, ? examples/s]" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dataset=load_dataset(\"json\",data_files={\"2023_math\":\"./data/json/2023/math.json\",\n", " \"2024_math\":\"./data/json/2024/math.json\"})" >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 ] }, { "cell_type": "code", <<<<<<< HEAD "execution_count": 25, ======= "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "221c4bba0e78418b9686c1ba0a0fa668", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Uploading the dataset shards: 0%| | 0/1 [00:00>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'id': 1,\n", " 'name': '1',\n", <<<<<<< HEAD " 'problem': '1. $\\\\left(2^{\\\\sqrt{3}} \\\\times 4\\\\right)^{\\\\sqrt{3} - 2}$ 의 값은? [2점] \\\\begin{itemize} \\\\item[1] \\\\frac{1}{4} \\\\item[2] \\\\frac{1}{2} \\\\item[3] 1 \\\\item[4] 2 \\\\item[5] 4 \\\\end{itemize}',\n", " 'answer': 2,\n", " 'score': 2,\n", " 'review': None,\n", " 'incomplete': False}" ] }, "execution_count": 25, ======= " 'problem': '1. \\\\left( \\\\frac{4}{2^{\\\\sqrt{2}}} \\\\right)^{2 + \\\\sqrt{2}} \\\\text{의 값은? [2점]}\\n\\n\\\\begin{itemize}\\n \\\\item[1] $\\\\frac{1}{4}$\\n \\\\item[2] $\\\\frac{1}{2}$\\n \\\\item[3] $1$\\n \\\\item[4] $2$\\n \\\\item[5] $4$\\n\\\\end{itemize}\\n',\n", " 'answer': -1,\n", " 'score': -1}" ] }, "execution_count": 4, >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 "metadata": {}, "output_type": "execute_result" } ], "source": [ <<<<<<< HEAD "dataset[\"2022_math\"][0]" ======= "dataset[\"2023_math\"][0]" >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 ] }, { "cell_type": "code", <<<<<<< HEAD "execution_count": 24, ======= "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 19, >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { <<<<<<< HEAD "model_id": "f612f040825040c6affa3b897f2633ef", ======= "model_id": "ed6870fcaa5d4641ae911c05f8d5e1a3", >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 "version_major": 2, "version_minor": 0 }, "text/plain": [ <<<<<<< HEAD "Pushing dataset shards to the dataset hub: 0%| | 0/1 [00:00>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 ] }, "metadata": {}, "output_type": "display_data" }, { "data": { <<<<<<< HEAD "application/vnd.jupyter.widget-view+json": { "model_id": "f3cb1129210b4586bbb81b52357c424e", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Creating parquet from Arrow format: 0%| | 0/1 [00:00>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 ] }, { "cell_type": "code", <<<<<<< HEAD ======= "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "DatasetDict({\n", " 2024_math: Dataset({\n", " features: ['id', 'name', 'problem', 'answer', 'score'],\n", " num_rows: 46\n", " })\n", "})" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "56b0357800c24f42af02e56bcd9f9133", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Creating json from Arrow format: 0%| | 0/1 [00:00>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv1", "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", <<<<<<< HEAD "version": "3.10.9" ======= "version": "3.8.9" >>>>>>> 41af016e94a20b80de932855d2fd5110dfdd4df6 } }, "nbformat": 4, "nbformat_minor": 2 }