diff --git "a/cnn_dailymail-cleaned.ipynb" "b/cnn_dailymail-cleaned.ipynb" new file mode 100644--- /dev/null +++ "b/cnn_dailymail-cleaned.ipynb" @@ -0,0 +1,5448 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lIYdn1woOS1n", + "outputId": "e8ba8f28-d1a2-4aab-97aa-0240f92cecab" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/175.4 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m\u001b[90m━━━━━━━\u001b[0m \u001b[32m143.4/175.4 kB\u001b[0m \u001b[31m4.0 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m175.4/175.4 kB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.8/44.8 kB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m235.5/235.5 kB\u001b[0m \u001b[31m9.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25h Building wheel for emoji (setup.py) ... \u001b[?25l\u001b[?25hdone\n" + ] + } + ], + "source": [ + "!pip install datasets hf-transfer clean-text[gpl] -U -q" + ] + }, + { + "cell_type": "code", + "source": [ + "import os\n", + "\n", + "os.environ['HF_HOME'] = '/workspace/local-HF-cache'" + ], + "metadata": { + "id": "p-0s0S5oldXW" + }, + "execution_count": 2, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "from datasets import load_dataset\n", + "\n", + "ds = load_dataset(\"abisee/cnn_dailymail\", \"3.0.0\", num_proc=8).rename_columns(\n", + " {\"article\": \"text\", \"highlights\": \"summary\"}\n", + ")\n", + "ds" + ], + "metadata": { + "id": "rEqVvnGelXpD", + "outputId": "57af1569-dc2a-4a4b-bf69-ee7d122aee0c", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "DatasetDict({\n", + " train: Dataset({\n", + " features: ['text', 'summary', 'id'],\n", + " num_rows: 287113\n", + " })\n", + " validation: Dataset({\n", + " features: ['text', 'summary', 'id'],\n", + " num_rows: 13368\n", + " })\n", + " test: Dataset({\n", + " features: ['text', 'summary', 'id'],\n", + " num_rows: 11490\n", + " })\n", + "})" + ] + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "cell_type": "code", + "source": [ + "from cleantext import clean\n", + "\n", + "ds = ds.map(lambda x: {\"summary\": clean(x[\"summary\"], lower=False, keep_two_line_breaks=True, no_emoji=True)}, num_proc=8)\n", + "ds" + ], + "metadata": { + "id": "bOqvQYxylgxT", + "outputId": "c0ca11a0-1f68-4b7b-a2db-f6099465397b", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 356, + "referenced_widgets": [ + "2495b11431534fef9fe179d574a12647", + "7d83c59cce2f4643a11a3568e1dee18f", + "42db380cdcd4437ea87874d669018645", + "7384e64dd0e0478b8110a9a621ba0c56", + "f38e353980674ebc9c908b34d3cbfbed", + "a8170345ee77490abb2ad2979d460a2f", + "f171482cb32e4e1bb66d8668bfb36021", + "0137a627c55548a686347238703f4b20", + "84bd9cc592fe45cfaa5caa123d690c23", + "2f475e4e9be240919b72b62abdd3b9a1", + "3cad88de9d4d49c1bcd0638de8b4f57f", + "464571d71b994bf88abd1a647fac66e9", + "369f6402acca4878815392bec0189da2", + "c866badd116a470e905aa9aa69a2500d", + "b30d7253bc9a410cbeea3ca1b25faff9", + "dccba8057eac4739a403ff7621ad9a2b", + "11beee80d98f4e5583c5cb8d6b0a9aad", + "a7a90cd4f1fc4822ad55153372bb1f49", + "1fd7d983199740298d338d8307f85d05", + "2b65efb2e63c44279d04ddd165cba9e5", + "8c50955ecbe84ca281842c05fb7c58a3", + "1431875a121443cc8946aa7d29d2c082", + "67126f36efd64ca588d7a993ad950f82", + "1210999efbc94612879937ccddde726f", + "ba4f1fbeaf5d4fc7a4caed3c09a442bd", + "34189bcc72ac4cc5b8bc333af4eb102f", + "46ca865077894914ad82bd6cc46f94b6", + "23ad31d71e1e44b28cf58a92f38ac7d0", + "512d9a51a12f40a3b70c8351047aca6e", + "ee185cd924ea47ca830b6bf7488d3122", + "b97b79ca1c2d42ed86f30234d9e6437e", + "4c47ee3528a34ac4b9e75bb6d81612b4", + "09d7fee497ce4e0a86159857a683ef91" + ] + } + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/plain": [ + "Map (num_proc=8): 0%| | 0/287113 [00:00