Team Ai
Modelpublic

CodeHima/TOSBert

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes12downloads
BertTOS.ipynb9366 linesDownload Raw Back to root
1{2  "cells": [3    {4      "cell_type": "code",5      "execution_count": null,6      "metadata": {7        "colab": {8          "base_uri": "https://localhost:8080/"9        },10        "id": "tasbRQSDXwbM",11        "outputId": "a55de5db-a80a-4b5e-8635-682965e63958"12      },13      "outputs": [14        {15          "name": "stdout",16          "output_type": "stream",17          "text": [18            "Requirement already satisfied: transformers in /usr/local/lib/python3.10/dist-packages (4.41.2)\n",19            "Collecting datasets\n",20            "  Downloading datasets-2.20.0-py3-none-any.whl (547 kB)\n",21            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m547.8/547.8 kB\u001b[0m \u001b[31m4.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",22            "\u001b[?25hRequirement already satisfied: torch in /usr/local/lib/python3.10/dist-packages (2.3.0+cu121)\n",23            "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (2.0.3)\n",24            "Requirement already satisfied: scikit-learn in /usr/local/lib/python3.10/dist-packages (1.2.2)\n",25            "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers) (3.15.3)\n",26            "Requirement already satisfied: huggingface-hub<1.0,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.23.4)\n",27            "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (1.25.2)\n",28            "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (24.1)\n",29            "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (6.0.1)\n",30            "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2024.5.15)\n",31            "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers) (2.31.0)\n",32            "Requirement already satisfied: tokenizers<0.20,>=0.19 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.19.1)\n",33            "Requirement already satisfied: safetensors>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.4.3)\n",34            "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.10/dist-packages (from transformers) (4.66.4)\n",35            "Collecting pyarrow>=15.0.0 (from datasets)\n",36            "  Downloading pyarrow-16.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (40.8 MB)\n",37            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.8/40.8 MB\u001b[0m \u001b[31m13.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",38            "\u001b[?25hRequirement already satisfied: pyarrow-hotfix in /usr/local/lib/python3.10/dist-packages (from datasets) (0.6)\n",39            "Collecting dill<0.3.9,>=0.3.0 (from datasets)\n",40            "  Downloading dill-0.3.8-py3-none-any.whl (116 kB)\n",41            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m116.3/116.3 kB\u001b[0m \u001b[31m11.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",42            "\u001b[?25hCollecting requests (from transformers)\n",43            "  Downloading requests-2.32.3-py3-none-any.whl (64 kB)\n",44            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.9/64.9 kB\u001b[0m \u001b[31m9.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",45            "\u001b[?25hCollecting xxhash (from datasets)\n",46            "  Downloading xxhash-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (194 kB)\n",47            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m194.1/194.1 kB\u001b[0m \u001b[31m22.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",48            "\u001b[?25hCollecting multiprocess (from datasets)\n",49            "  Downloading multiprocess-0.70.16-py310-none-any.whl (134 kB)\n",50            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m134.8/134.8 kB\u001b[0m \u001b[31m20.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",51            "\u001b[?25hRequirement already satisfied: fsspec[http]<=2024.5.0,>=2023.1.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (2023.6.0)\n",52            "Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from datasets) (3.9.5)\n",53            "Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.10/dist-packages (from torch) (4.12.2)\n",54            "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch) (1.12.1)\n",55            "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch) (3.3)\n",56            "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch) (3.1.4)\n",57            "Collecting nvidia-cuda-nvrtc-cu12==12.1.105 (from torch)\n",58            "  Using cached nvidia_cuda_nvrtc_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (23.7 MB)\n",59            "Collecting nvidia-cuda-runtime-cu12==12.1.105 (from torch)\n",60            "  Using cached nvidia_cuda_runtime_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (823 kB)\n",61            "Collecting nvidia-cuda-cupti-cu12==12.1.105 (from torch)\n",62            "  Using cached nvidia_cuda_cupti_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (14.1 MB)\n",63            "Collecting nvidia-cudnn-cu12==8.9.2.26 (from torch)\n",64            "  Using cached nvidia_cudnn_cu12-8.9.2.26-py3-none-manylinux1_x86_64.whl (731.7 MB)\n",65            "Collecting nvidia-cublas-cu12==12.1.3.1 (from torch)\n",66            "  Using cached nvidia_cublas_cu12-12.1.3.1-py3-none-manylinux1_x86_64.whl (410.6 MB)\n",67            "Collecting nvidia-cufft-cu12==11.0.2.54 (from torch)\n",68            "  Using cached nvidia_cufft_cu12-11.0.2.54-py3-none-manylinux1_x86_64.whl (121.6 MB)\n",69            "Collecting nvidia-curand-cu12==10.3.2.106 (from torch)\n",70            "  Using cached nvidia_curand_cu12-10.3.2.106-py3-none-manylinux1_x86_64.whl (56.5 MB)\n",71            "Collecting nvidia-cusolver-cu12==11.4.5.107 (from torch)\n",72            "  Using cached nvidia_cusolver_cu12-11.4.5.107-py3-none-manylinux1_x86_64.whl (124.2 MB)\n",73            "Collecting nvidia-cusparse-cu12==12.1.0.106 (from torch)\n",74            "  Using cached nvidia_cusparse_cu12-12.1.0.106-py3-none-manylinux1_x86_64.whl (196.0 MB)\n",75            "Collecting nvidia-nccl-cu12==2.20.5 (from torch)\n",76            "  Using cached nvidia_nccl_cu12-2.20.5-py3-none-manylinux2014_x86_64.whl (176.2 MB)\n",77            "Collecting nvidia-nvtx-cu12==12.1.105 (from torch)\n",78            "  Using cached nvidia_nvtx_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (99 kB)\n",79            "Requirement already satisfied: triton==2.3.0 in /usr/local/lib/python3.10/dist-packages (from torch) (2.3.0)\n",80            "Collecting nvidia-nvjitlink-cu12 (from nvidia-cusolver-cu12==11.4.5.107->torch)\n",81            "  Downloading nvidia_nvjitlink_cu12-12.5.40-py3-none-manylinux2014_x86_64.whl (21.3 MB)\n",82            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m21.3/21.3 MB\u001b[0m \u001b[31m62.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",83            "\u001b[?25hRequirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.10/dist-packages (from pandas) (2.8.2)\n",84            "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas) (2023.4)\n",85            "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas) (2024.1)\n",86            "Requirement already satisfied: scipy>=1.3.2 in /usr/local/lib/python3.10/dist-packages (from scikit-learn) (1.11.4)\n",87            "Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-learn) (1.4.2)\n",88            "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn) (3.5.0)\n",89            "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.3.1)\n",90            "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (23.2.0)\n",91            "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.4.1)\n",92            "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (6.0.5)\n",93            "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.9.4)\n",94            "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (4.0.3)\n",95            "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n",96            "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.3.2)\n",97            "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.7)\n",98            "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2.0.7)\n",99            "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2024.6.2)\n",100            "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch) (2.1.5)\n",101            "Requirement already satisfied: mpmath<1.4.0,>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from sympy->torch) (1.3.0)\n",102            "Installing collected packages: xxhash, requests, pyarrow, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, dill, nvidia-cusparse-cu12, nvidia-cudnn-cu12, multiprocess, nvidia-cusolver-cu12, datasets\n",103            "  Attempting uninstall: requests\n",104            "    Found existing installation: requests 2.31.0\n",105            "    Uninstalling requests-2.31.0:\n",106            "      Successfully uninstalled requests-2.31.0\n",107            "  Attempting uninstall: pyarrow\n",108            "    Found existing installation: pyarrow 14.0.2\n",109            "    Uninstalling pyarrow-14.0.2:\n",110            "      Successfully uninstalled pyarrow-14.0.2\n",111            "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",112            "cudf-cu12 24.4.1 requires pyarrow<15.0.0a0,>=14.0.1, but you have pyarrow 16.1.0 which is incompatible.\n",113            "google-colab 1.0.0 requires requests==2.31.0, but you have requests 2.32.3 which is incompatible.\n",114            "ibis-framework 8.0.0 requires pyarrow<16,>=2, but you have pyarrow 16.1.0 which is incompatible.\u001b[0m\u001b[31m\n",115            "\u001b[0mSuccessfully installed datasets-2.20.0 dill-0.3.8 multiprocess-0.70.16 nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-8.9.2.26 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.20.5 nvidia-nvjitlink-cu12-12.5.40 nvidia-nvtx-cu12-12.1.105 pyarrow-16.1.0 requests-2.32.3 xxhash-3.4.1\n",116            "Requirement already satisfied: transformers[torch] in /usr/local/lib/python3.10/dist-packages (4.41.2)\n",117            "Collecting transformers[torch]\n",118            "  Downloading transformers-4.42.1-py3-none-any.whl (9.3 MB)\n",119            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.3/9.3 MB\u001b[0m \u001b[31m65.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",120            "\u001b[?25hCollecting accelerate\n",121            "  Downloading accelerate-0.31.0-py3-none-any.whl (309 kB)\n",122            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m309.4/309.4 kB\u001b[0m \u001b[31m38.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",123            "\u001b[?25hRequirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (3.15.3)\n",124            "Requirement already satisfied: huggingface-hub<1.0,>=0.23.2 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (0.23.4)\n",125            "Requirement already satisfied: numpy<2.0,>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (1.25.2)\n",126            "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (24.1)\n",127            "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (6.0.1)\n",128            "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (2024.5.15)\n",129            "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (2.32.3)\n",130            "Requirement already satisfied: tokenizers<0.20,>=0.19 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (0.19.1)\n",131            "Requirement already satisfied: safetensors>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (0.4.3)\n",132            "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (4.66.4)\n",133            "Requirement already satisfied: torch in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (2.3.0+cu121)\n",134            "Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from accelerate) (5.9.5)\n",135            "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.23.2->transformers[torch]) (2023.6.0)\n",136            "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.23.2->transformers[torch]) (4.12.2)\n",137            "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (1.12.1)\n",138            "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (3.3)\n",139            "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (3.1.4)\n",140            "Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (12.1.105)\n",141            "Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (12.1.105)\n",142            "Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (12.1.105)\n",143            "Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (8.9.2.26)\n",144            "Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (12.1.3.1)\n",145            "Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (11.0.2.54)\n",146            "Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (10.3.2.106)\n",147            "Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (11.4.5.107)\n",148            "Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (12.1.0.106)\n",149            "Requirement already satisfied: nvidia-nccl-cu12==2.20.5 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (2.20.5)\n",150            "Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (12.1.105)\n",151            "Requirement already satisfied: triton==2.3.0 in /usr/local/lib/python3.10/dist-packages (from torch->transformers[torch]) (2.3.0)\n",152            "Requirement already satisfied: nvidia-nvjitlink-cu12 in /usr/local/lib/python3.10/dist-packages (from nvidia-cusolver-cu12==11.4.5.107->torch->transformers[torch]) (12.5.40)\n",153            "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (3.3.2)\n",154            "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (3.7)\n",155            "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (2.0.7)\n",156            "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (2024.6.2)\n",157            "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch->transformers[torch]) (2.1.5)\n",158            "Requirement already satisfied: mpmath<1.4.0,>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from sympy->torch->transformers[torch]) (1.3.0)\n",159            "Installing collected packages: transformers, accelerate\n",160            "  Attempting uninstall: transformers\n",161            "    Found existing installation: transformers 4.41.2\n",162            "    Uninstalling transformers-4.41.2:\n",163            "      Successfully uninstalled transformers-4.41.2\n",164            "Successfully installed accelerate-0.31.0 transformers-4.42.1\n"165          ]166        }167      ],168      "source": [169        "!pip install transformers datasets torch pandas scikit-learn\n",170        "!pip install transformers[torch] accelerate -U"171      ]172    },173    {174      "cell_type": "code",175      "execution_count": null,176      "metadata": {177        "colab": {178          "base_uri": "https://localhost:8080/",179          "height": 1000,180          "referenced_widgets": [181            "608af326de2242889e727a2877c0bb5b",182            "bdba4fd237ac481f8fe441dfdf7af37f",183            "3af3d9f038d24da9afe99e447c265076",184            "1f432ed94ea54603a62fa2f9d8869e50",185            "886aaed06007439988b0c7122c38da7a",186            "b08c3eb38db642b7af4dea2253ceb448",187            "6b5b7f38314d47688cb816819dd7b6b9",188            "d02e7ae5971f4905b4dc4807d80dead6",189            "4ae210f24db44a7c89ad512a9976c31d",190            "5a41b084718742b4a5045de83b3f0908",191            "4ac8e4a2cfd544e4b422c35a66f789ba",192            "a86ee83ce05d44cba410a7212ac4679f",193            "141ed35e338049f9987b5a850edc9235",194            "8e748ba5d14e4df2bade5728f336373a",195            "8e4ac9b5b23443c795dc7c3d6fc530c6",196            "214190484d8e4916809718a71f8173c3",197            "2643808dd5bf40fb94c9b00d97946f48",198            "47ee6f2815e7459497285344b77edf2e",199            "635099c5859d4f62ab8fc720022a44e4",200            "0fe88dfc13b941fdb59f434660aa37cd",201            "aa047fefcbed4ae78d271569532a30f3",202            "a3fd17a3532d4295adfc91f9eb807a46",203            "9e00e6e03c7246b1ac9e085fe707605a",204            "1971dbdd817a49dc9e7912d41cf9c3dd",205            "cc9c26e15cb240489fac81640842ce57",206            "79c7da23ef0c48fdb9df0a18669c3532",207            "79fe8ce6a3b8418fa2cf97034ddf0617",208            "94d70350cc644d04a07c32812ac01477",209            "b4a7a0148f7a4fa681a1ba6a07ad3770",210            "66937cf288b84713ac1a784bf6ee9788",211            "c181bf858ffd47b9b13322e9fec4fbee",212            "f69d9e2699734cf5898a5da895a6a3ee",213            "2b69f12a5a094c8d9225e29b0aab8a51",214            "1ff966156350485bab4fe6fa4c05d828",215            "a47516fb203a499183f02c169802d030",216            "2408ceb9569f42bb93d834f82e2ec9cb",217            "d97fb70eb1334e0293d0f31099a140ef",218            "43217f46fb3f4684a61b3dd272186276",219            "c70435a43a6a44f781e70099d3e806f8",220            "bd967277412b4de191d6970a839c3594",221            "78ae85ae81084225ab019dc482f68c12",222            "ac656b624f5143a4956529aa842679b2",223            "5c3b00b97bed4280bb6648f22bb16c9f",224            "a1db27dd1a054e8095b1fa6a728765d9",225            "7df147073dbd466eb7a813065e9f1268",226            "5c783f92ee144abd9480bd88f84ef3ae",227            "0628714a01844392a9deb83a69848348",228            "f9031d76f5534a50a193d3125b4cdbd0",229            "e7d5194f16654e2386fa457fd62e7029",230            "120e9f6f74284c82aba4dd7a0ee6dc02",231            "83d2c6787070463a84db32774f0b0e9c",232            "6f55f633c08848848559ce64b4f206fc",233            "ec993f04d2664d198fabe4a72abb1e0e",234            "242721d8a1e149f3a94eb47620df5206",235            "7fe5de47493b4d6ba6a54112c9e1c566",236            "5d4f6eef12514ea2a6b8dcb8b4e8a4c7",237            "fcae860544ca47deb139dae619e3a70b",238            "ef20fe944c9b4175b055c416c90546be",239            "6914e247249c4697811c06465321aa4f",240            "1e5a26a88b18455bb14933c456569f62",241            "b7c673a72e6d481a96d7c2c90689446a",242            "eb7481aaf3d144daadfbd0d8bdf063dc",243            "7eba962341404bf5a7f0c56d3276dc22",244            "d70298b0e2d9478eb7b10d191f73e636",245            "6886676a000a4ad192f45b9a139e39b7",246            "bb1899fc9151435685b3394db66400b0",247            "0c87dae755db45bfbfb027996b708a20",248            "dc6008c6f7824e578a58258f07ef51d2",249            "0b262343040c41c79da7333d86202dd0",250            "c22b42dd77fd4564822cd05c5c7c04f9",251            "021d6748dd354f37ac5f74f015208632",252            "4989510db0bd4954af7a26d197640d29",253            "73adc7555cd04e3387805a577732d2bd",254            "210f81dc08f3487d97d7df5f7df120e0",255            "463dd8315ffb4fe99840765b2db946e6",256            "74c88a66ace64f418504ae32ed5f910e",257            "ac522be91b394adda566c43dda8e0ba3",258            "704ae61475d844d9bb30c1161adc849b",259            "3e9a5d0cbbc64a17942790a321f7619c",260            "01b57fbfe4b94a909dcf8328c1fdae9e",261            "cc903dc9905e44eeaf138a5f4e157d8e",262            "c5cce05266cb40d8bd88896a951736ea",263            "eef894475e4f4f709eab9bb8129102f1",264            "7f7360182e9a4db3b7b7b0e8e4edf062",265            "f8c9d5b2845c414b8aaa3834bf672f8f",266            "f8e9d0cf80794c1b8f70614ff95aadd9",267            "d60a9887d3684a40bb78832ca24d2946",268            "23f62d1849244446b2f5d99fe35a691f",269            "06303264a4c54602abfbfd7824849d95",270            "d5f8b2ce69ad47e9b38467fc3aa28077",271            "d6758c69249c4285830f70c7b771c327",272            "b022e1e10ac3401eafbfd296b9341bb6",273            "edac283b07004319b93e03ae37a61749",274            "2e926dbd28c14797a7abe61192378c17",275            "1882580707114c04a10c06c2c304d62d",276            "aabd4e5edbe14048a05a7b14bb6686cd",277            "ad0d25ee054a42bf9e1c167a6923ddda",278            "391ebb0325c94c369fb72b3d8fa13573",279            "be966e5077344c089bf7b3588746e871",280            "af0da36f318c493082be9cf56f020286",281            "d9ec6fe87ea943f8912a511352218e27",282            "acec772e03a24708b09e3fb757684d3d",283            "5ce84c48d2554af1a447c6c847940a1f",284            "6c4342113ff046749cb81fe3176249e2",285            "c18b9753bce047c7a581003b9b70fa9b",286            "d2519fd681f741f9b174827c03765f58",287            "6c757d2243d84e6db9ec744327c1ba4f",288            "ace54811a6ba4c128ab41a5614e1ea61",289            "d17b181c8f3943cb997de11b75a0158b",290            "0862985b1f4847c8bd085e9842bd9980",291            "3c50f516d42a4f61aba492a2f4144de3",292            "e9ca7cce5fb44a1da3669f9cd716ee86",293            "c9282f17fdb64404b876b255eb9bb716",294            "2e2d0f81ddb24bcc99a84e91c390f9b0",295            "22afc41b8a1349b6a878dae3f73d6529",296            "7724d3807cd04d0e94ab43252e35f443",297            "aecf47ac5fe44fc8851892eb208003a9",298            "8db33f95622743968262d169f0645a9a",299            "4e1767d760044c2cbe7fdc6f904e7c1a",300            "1a4a444a99f14d518bcf803f7f2e3621",301            "ea8b595957fb449ab4f753b59fc27bcb",302            "bd06545a558a4d32bc31ef08be1b462f",303            "694af7df4ef24a09bbcd53e1bd2caebc",304            "60fc1c53ce7541609b61667517e8256a",305            "864e5050c5ee440e8a8876e17c471602",306            "eef8ac97ca7248928282599bbe529cbf",307            "bb20836d71ea48c59070f99e55880431",308            "2c0c2bb03af14db09e762e32363a26c8",309            "9bb0a4db0bcf4c319b082a7f519f6100",310            "382b0c4509964e1481bca4e1b72bc03e",311            "91b31e62c4db4e56baacc20f7004bcba",312            "f937f4c9a86c43f8a58453748afc48e9",313            "d200a5f13673428692ff8c5f068f73e5",314            "e86294f380814d3497ff35e7ab35f5e7",315            "4b46d122f0ea4da2aa569995fea8e291",316            "2585b993407a4d0da0513ed38eeca179",317            "cfe12b946de8450aa27b1d8c9a302529",318            "30569087dac542168f6b8111a8a3226e",319            "2cb7188bcee04c4c9e75e838288590e0",320            "cc800b59ee174083956ab2733b055387",321            "81f75ddf24a0439cb83b8756e6fde429",322            "d99664f92365471fa68cc62ce7580b4a",323            "99f7d4618ae44115bf6ac7c7a6b7a7eb",324            "af220c81655b40c9a2fff2662e6d62e2",325            "c47e4ab730c1425e9ed21003ef1a1925",326            "62aa8c5538964f8787b94ada1a11b1bf",327            "b9577c2dddd34fd79df8cf2d33699d8c",328            "86d943fba28449c1a28e0458f67946f6",329            "8c315ccd594c47f2971e19d7c9b67e16",330            "e68442ebe65b40a88ac2c64eae9b156a",331            "f51db10eba404b529ecb739ff2501ae3",332            "b48492e8b1614c6c91f7afc0452a2733",333            "3ceb13cb43254dfda1eb179d428852cd",334            "c4d74dde8011438fb3f72d4e6b1669b9",335            "428aa960402b42c3a7ec6a3cbdf8b882",336            "8b7a2221e3be47fb99a7eb8f995ac3a5",337            "c353176fb04f4ab38e6b7ca93d00e892",338            "d5b9b86121e2480892f01865340b0a77",339            "5effd9d505a045bb913b7e85198fea6f",340            "86d53d4e83c24de8b66e66c33577c37e",341            "3fca1a25a471470d961a4e7a330a6e4c",342            "41c527c983c94804897309fc52733040",343            "bfd37e303f494a57a5a32a36927fa8bc",344            "b247d77de93441678939b92e4a2aba45",345            "757c3c9c48644a6e951da6955d516d39",346            "7d9a119148824edd92acec593cfd5a01",347            "fb3cdcbd798e4db9ade638e6546d6a52",348            "9d9a698a663441b69c7c943876ae2fc5",349            "26b0d0d45abc412f8392866b56593753",350            "2e8384ba3c324fc391bd9904b63bcec2",351            "4b2341fea42643ccbdaf9a91ce4430ea",352            "9b05f64b41b84dfc8d9c0e4576ba6088",353            "de2778ef488f4a9582b2b3028fc73ca0",354            "23e839b7e9754cfdb97c9d3c351d400c",355            "1449a5dd216649bd81208ad09699b085",356            "373313df9b2744859bdfaa2ed4a907c0",357            "01d0ae95869643bdb7800c8bf3aa3a68",358            "2fb53aa5b2d245efb3cf99d2d3bd9235",359            "4406f83c736a4da98fd69ca964d1ea61",360            "525769cc196d4b1ea49f1e48e9066197",361            "e3467d674f274035b55768b54a54c7aa",362            "3b7c1ad277544f43ae955338757e11cb",363            "ed6e51e7630e4e7c8eee7748c5b5578f",364            "c838ff7d314f4712a98fbab6adb8247e",365            "cdc10266e81a4dcc92d85b71fd049ccc",366            "c6434858e9f247a5ad88dfe94cebac77",367            "209c6b932a544ea4873ece6b0bdd0a17",368            "fdba0ca159d84542ac62c07b8736d5d7",369            "a339c0935c814d0680e1fcf28ea87958",370            "cdcb64a75f874bdd9472790962da26b3",371            "bdbfde41cc264217a487edca9210f58b",372            "474049a26353453583d80c914e17ad1f",373            "ee44fbbdea4149969d68e53f9922b153",374            "c2977a26952a4583a8ce9be96544c272",375            "7a6e67d9b37f4bacaa7cf4f987025867",376            "103155a844764ab889f8e7533b6df179",377            "dbcc08beaaae4a31bb4d26c6a485ea30",378            "c5429ba2f58c426283e5d594d8912f21",379            "350a156e43eb4ad38c67e957afa1f988",380            "9d9668a9edca458cbd27952ae8a11ffb",381            "e7b7cd196d5f464cafcd8a1d6ce87abc",382            "f7439044feed466bafee87bdbca0bbb5",383            "9a8a5d1166a14a97af454d3e9da8d9fc",384            "639a7e28d4464e919a1253b76f7fe124",385            "aa77d7c078594da7bf28d408a9ca7859",386            "7c9c122dd2694066b1bcc66d00a870ae",387            "1f365d4d989a4e6c8126e8439c0ba77b",388            "7a5b226795924570a3c0831584d95377",389            "5c2db76cbd8240dea052ce7b4f9955f7",390            "71256504f6184bfda450a693003df182",391            "aa566f8a2c6f4f539a11aabaa138bc49",392            "d711f846dd844a22916f7ff29700c88f",393            "2ba3f59451c24220825557bf0a9caffb",394            "ae6b4f10c59840a5b96a906a6aa54b71",395            "e394be2150464bdb83b52dfb1b2247db",396            "0fa8c1ad13654381a72fa211c2b7055a",397            "01d6d5cbc52546308733ac51b54270c5",398            "2eb8f9ac0b3c40a18dc9c5c8fd80ebc7",399            "f0711edd7abe445a99cdc998be1681f1",400            "838b664d53a14194b517799528bb7c7a",401            "11887762e5c247f5b937720797fea17b",402            "30622c69183f48d9978fbba5d43440a3",403            "af8ac2b0045043a8afdcc64b83bba0dc",404            "1523aa134b954cf6b43d4b1ebe8752cd",405            "e12fa20677e64bb194e9a3cc5e12067d",406            "ed93bafd42b647cf9cd082e61eccb2aa",407            "69b0b7cbd95048e0959ddbfbb9a91f12",408            "f6e39b853a5d42c8b998054ac9be67c1",409            "4ae9b21b04ba436cbd44e46fafef8c17",410            "1710f1e1bcf748cfb05f415e76a3f1df",411            "cdb03aeed181453dbaa839aed83b2856"412          ]413        },414        "id": "xurGRBN7X43b",415        "outputId": "145bd1f0-3839-4f4a-8bc3-5292b40eee35"416      },417      "outputs": [418        {419          "name": "stderr",420          "output_type": "stream",421          "text": [422            "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:89: UserWarning: \n",423            "The secret `HF_TOKEN` does not exist in your Colab secrets.\n",424            "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n",425            "You will be able to reuse this secret in all of your notebooks.\n",426            "Please note that authentication is recommended but still optional to access public models or datasets.\n",427            "  warnings.warn(\n"428          ]429        },430        {431          "data": {432            "application/vnd.jupyter.widget-view+json": {433              "model_id": "608af326de2242889e727a2877c0bb5b",434              "version_major": 2,435              "version_minor": 0436            },437            "text/plain": [438              "Downloading readme:   0%|          | 0.00/18.3k [00:00<?, ?B/s]"439            ]440          },441          "metadata": {},442          "output_type": "display_data"443        },444        {445          "data": {446            "application/vnd.jupyter.widget-view+json": {447              "model_id": "a86ee83ce05d44cba410a7212ac4679f",448              "version_major": 2,449              "version_minor": 0450            },451            "text/plain": [452              "Downloading data:   0%|          | 0.00/7.42M [00:00<?, ?B/s]"453            ]454          },455          "metadata": {},456          "output_type": "display_data"457        },458        {459          "data": {460            "application/vnd.jupyter.widget-view+json": {461              "model_id": "9e00e6e03c7246b1ac9e085fe707605a",462              "version_major": 2,463              "version_minor": 0464            },465            "text/plain": [466              "Downloading data:   0%|          | 0.00/649k [00:00<?, ?B/s]"467            ]468          },469          "metadata": {},470          "output_type": "display_data"471        },472        {473          "data": {474            "application/vnd.jupyter.widget-view+json": {475              "model_id": "1ff966156350485bab4fe6fa4c05d828",476              "version_major": 2,477              "version_minor": 0478            },479            "text/plain": [480              "Downloading data:   0%|          | 0.00/1.62M [00:00<?, ?B/s]"481            ]482          },483          "metadata": {},484          "output_type": "display_data"485        },486        {487          "data": {488            "application/vnd.jupyter.widget-view+json": {489              "model_id": "7df147073dbd466eb7a813065e9f1268",490              "version_major": 2,491              "version_minor": 0492            },493            "text/plain": [494              "Generating train split:   0%|          | 0/19942 [00:00<?, ? examples/s]"495            ]496          },497          "metadata": {},498          "output_type": "display_data"499        },500        {501          "data": {502            "application/vnd.jupyter.widget-view+json": {503              "model_id": "5d4f6eef12514ea2a6b8dcb8b4e8a4c7",504              "version_major": 2,505              "version_minor": 0506            },507            "text/plain": [508              "Generating validation split:   0%|          | 0/1690 [00:00<?, ? examples/s]"509            ]510          },511          "metadata": {},512          "output_type": "display_data"513        },514        {515          "data": {516            "application/vnd.jupyter.widget-view+json": {517              "model_id": "0c87dae755db45bfbfb027996b708a20",518              "version_major": 2,519              "version_minor": 0520            },521            "text/plain": [522              "Generating test split:   0%|          | 0/4297 [00:00<?, ? examples/s]"523            ]524          },525          "metadata": {},526          "output_type": "display_data"527        },528        {529          "data": {530            "application/vnd.jupyter.widget-view+json": {531              "model_id": "704ae61475d844d9bb30c1161adc849b",532              "version_major": 2,533              "version_minor": 0534            },535            "text/plain": [536              "Filter:   0%|          | 0/19942 [00:00<?, ? examples/s]"537            ]538          },539          "metadata": {},540          "output_type": "display_data"541        },542        {543          "data": {544            "application/vnd.jupyter.widget-view+json": {545              "model_id": "06303264a4c54602abfbfd7824849d95",546              "version_major": 2,547              "version_minor": 0548            },549            "text/plain": [550              "Filter:   0%|          | 0/1690 [00:00<?, ? examples/s]"551            ]552          },553          "metadata": {},554          "output_type": "display_data"555        },556        {557          "data": {558            "application/vnd.jupyter.widget-view+json": {559              "model_id": "af0da36f318c493082be9cf56f020286",560              "version_major": 2,561              "version_minor": 0562            },563            "text/plain": [564              "Filter:   0%|          | 0/4297 [00:00<?, ? examples/s]"565            ]566          },567          "metadata": {},568          "output_type": "display_data"569        },570        {571          "data": {572            "application/vnd.jupyter.widget-view+json": {573              "model_id": "3c50f516d42a4f61aba492a2f4144de3",574              "version_major": 2,575              "version_minor": 0576            },577            "text/plain": [578              "Map:   0%|          | 0/5378 [00:00<?, ? examples/s]"579            ]580          },581          "metadata": {},582          "output_type": "display_data"583        },584        {585          "data": {586            "application/vnd.jupyter.widget-view+json": {587              "model_id": "bd06545a558a4d32bc31ef08be1b462f",588              "version_major": 2,589              "version_minor": 0590            },591            "text/plain": [592              "Map:   0%|          | 0/415 [00:00<?, ? examples/s]"593            ]594          },595          "metadata": {},596          "output_type": "display_data"597        },598        {599          "data": {600            "application/vnd.jupyter.widget-view+json": {601              "model_id": "d200a5f13673428692ff8c5f068f73e5",602              "version_major": 2,603              "version_minor": 0604            },605            "text/plain": [606              "Map:   0%|          | 0/1038 [00:00<?, ? examples/s]"607            ]608          },609          "metadata": {},610          "output_type": "display_data"611        },612        {613          "data": {614            "application/vnd.jupyter.widget-view+json": {615              "model_id": "af220c81655b40c9a2fff2662e6d62e2",616              "version_major": 2,617              "version_minor": 0618            },619            "text/plain": [620              "tokenizer_config.json:   0%|          | 0.00/48.0 [00:00<?, ?B/s]"621            ]622          },623          "metadata": {},624          "output_type": "display_data"625        },626        {627          "data": {628            "application/vnd.jupyter.widget-view+json": {629              "model_id": "428aa960402b42c3a7ec6a3cbdf8b882",630              "version_major": 2,631              "version_minor": 0632            },633            "text/plain": [634              "vocab.txt:   0%|          | 0.00/232k [00:00<?, ?B/s]"635            ]636          },637          "metadata": {},638          "output_type": "display_data"639        },640        {641          "data": {642            "application/vnd.jupyter.widget-view+json": {643              "model_id": "7d9a119148824edd92acec593cfd5a01",644              "version_major": 2,645              "version_minor": 0646            },647            "text/plain": [648              "tokenizer.json:   0%|          | 0.00/466k [00:00<?, ?B/s]"649            ]650          },651          "metadata": {},652          "output_type": "display_data"653        },654        {655          "data": {656            "application/vnd.jupyter.widget-view+json": {657              "model_id": "01d0ae95869643bdb7800c8bf3aa3a68",658              "version_major": 2,659              "version_minor": 0660            },661            "text/plain": [662              "config.json:   0%|          | 0.00/570 [00:00<?, ?B/s]"663            ]664          },665          "metadata": {},666          "output_type": "display_data"667        },668        {669          "data": {670            "application/vnd.jupyter.widget-view+json": {671              "model_id": "fdba0ca159d84542ac62c07b8736d5d7",672              "version_major": 2,673              "version_minor": 0674            },675            "text/plain": [676              "Map:   0%|          | 0/5378 [00:00<?, ? examples/s]"677            ]678          },679          "metadata": {},680          "output_type": "display_data"681        },682        {683          "data": {684            "application/vnd.jupyter.widget-view+json": {685              "model_id": "350a156e43eb4ad38c67e957afa1f988",686              "version_major": 2,687              "version_minor": 0688            },689            "text/plain": [690              "Map:   0%|          | 0/415 [00:00<?, ? examples/s]"691            ]692          },693          "metadata": {},694          "output_type": "display_data"695        },696        {697          "data": {698            "application/vnd.jupyter.widget-view+json": {699              "model_id": "71256504f6184bfda450a693003df182",700              "version_major": 2,701              "version_minor": 0702            },703            "text/plain": [704              "Map:   0%|          | 0/1038 [00:00<?, ? examples/s]"705            ]706          },707          "metadata": {},708          "output_type": "display_data"709        },710        {711          "data": {712            "application/vnd.jupyter.widget-view+json": {713              "model_id": "11887762e5c247f5b937720797fea17b",714              "version_major": 2,715              "version_minor": 0716            },717            "text/plain": [718              "model.safetensors:   0%|          | 0.00/440M [00:00<?, ?B/s]"719            ]720          },721          "metadata": {},722          "output_type": "display_data"723        },724        {725          "name": "stderr",726          "output_type": "stream",727          "text": [728            "Some weights of BertForSequenceClassification were not initialized from the model checkpoint at bert-base-uncased and are newly initialized: ['classifier.bias', 'classifier.weight']\n",729            "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n",730            "/usr/local/lib/python3.10/dist-packages/transformers/training_args.py:1494: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead\n",731            "  warnings.warn(\n"732          ]733        },734        {735          "data": {736            "text/html": [737              "\n",738              "    <div>\n",739              "      \n",740              "      <progress value='1011' max='1011' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",741              "      [1011/1011 24:18, Epoch 3/3]\n",742              "    </div>\n",743              "    <table border=\"1\" class=\"dataframe\">\n",744              "  <thead>\n",745              " <tr style=\"text-align: left;\">\n",746              "      <th>Epoch</th>\n",747              "      <th>Training Loss</th>\n",748              "      <th>Validation Loss</th>\n",749              "      <th>Accuracy</th>\n",750              "      <th>F1</th>\n",751              "      <th>Precision</th>\n",752              "      <th>Recall</th>\n",753              "    </tr>\n",754              "  </thead>\n",755              "  <tbody>\n",756              "    <tr>\n",757              "      <td>1</td>\n",758              "      <td>0.083600</td>\n",759              "      <td>0.069475</td>\n",760              "      <td>0.881928</td>\n",761              "      <td>0.000000</td>\n",762              "      <td>0.000000</td>\n",763              "      <td>0.000000</td>\n",764              "    </tr>\n",765              "    <tr>\n",766              "      <td>2</td>\n",767              "      <td>0.046200</td>\n",768              "      <td>0.039438</td>\n",769              "      <td>0.881928</td>\n",770              "      <td>0.000000</td>\n",771              "      <td>0.000000</td>\n",772              "      <td>0.000000</td>\n",773              "    </tr>\n",774              "    <tr>\n",775              "      <td>3</td>\n",776              "      <td>0.024100</td>\n",777              "      <td>0.032754</td>\n",778              "      <td>0.910843</td>\n",779              "      <td>0.428571</td>\n",780              "      <td>0.882353</td>\n",781              "      <td>0.283019</td>\n",782              "    </tr>\n",783              "  </tbody>\n",784              "</table><p>"785            ],786            "text/plain": [787              "<IPython.core.display.HTML object>"788            ]789          },790          "metadata": {},791          "output_type": "display_data"792        },793        {794          "name": "stderr",795          "output_type": "stream",796          "text": [797            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 due to no predicted samples. Use `zero_division` parameter to control this behavior.\n",798            "  _warn_prf(average, modifier, msg_start, len(result))\n",799            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 due to no predicted samples. Use `zero_division` parameter to control this behavior.\n",800            "  _warn_prf(average, modifier, msg_start, len(result))\n"801          ]802        },803        {804          "data": {805            "text/html": [806              "\n",807              "    <div>\n",808              "      \n",809              "      <progress value='91' max='26' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",810              "      [26/26 00:40]\n",811              "    </div>\n",812              "    "813            ],814            "text/plain": [815              "<IPython.core.display.HTML object>"816            ]817          },818          "metadata": {},819          "output_type": "display_data"820        },821        {822          "name": "stdout",823          "output_type": "stream",824          "text": [825            "Validation Accuracy: 0.9108433734939759\n",826            "Test Accuracy: 0.928709055876686\n"827          ]828        },829        {830          "data": {831            "text/plain": [832              "['./tos-bert-classifier/mlb.joblib']"833            ]834          },835          "execution_count": 2,836          "metadata": {},837          "output_type": "execute_result"838        }839      ],840      "source": [841        "from datasets import load_dataset, concatenate_datasets\n",842        "from transformers import BertTokenizer, BertForSequenceClassification, Trainer, TrainingArguments\n",843        "from sklearn.metrics import accuracy_score, precision_recall_fscore_support\n",844        "from sklearn.preprocessing import MultiLabelBinarizer\n",845        "import torch\n",846        "import numpy as np\n",847        "\n",848        "# Load the dataset\n",849        "dataset = load_dataset('joelniklaus/online_terms_of_service')\n",850        "\n",851        "# Filter for English sentences only\n",852        "dataset = dataset.filter(lambda x: x['language'] == 'en')\n",853        "\n",854        "# Prepare the data: combine the individual boolean tags into a single label\n",855        "def combine_labels(example):\n",856        "    labels = ['a', 'ch', 'cr', 'j', 'law', 'ltd', 'ter', 'use', 'pinc']\n",857        "    combined_label = [label for label in labels if example[label]]\n",858        "    example['combined_label'] = combined_label\n",859        "    return example\n",860        "\n",861        "dataset = dataset.map(combine_labels)\n",862        "\n",863        "# Split the dataset into train, validation, and test\n",864        "train_data = dataset['train']\n",865        "validation_data = dataset['validation']\n",866        "test_data = dataset['test']\n",867        "\n",868        "# Initialize the tokenizer\n",869        "tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')\n",870        "\n",871        "# Create MultiLabelBinarizer\n",872        "mlb = MultiLabelBinarizer()\n",873        "# Concatenate datasets correctly\n",874        "all_data = concatenate_datasets([train_data, validation_data, test_data])\n",875        "all_labels = all_data['combined_label']\n",876        "mlb.fit(all_labels)\n",877        "\n",878        "def tokenize_and_encode_labels(examples):\n",879        "    tokenized = tokenizer(examples['sentence'], padding='max_length', truncation=True)\n",880        "    labels = mlb.transform(examples['combined_label'])\n",881        "    tokenized['labels'] = torch.FloatTensor(labels)  # Convert labels to FloatTensor\n",882        "    return tokenized\n",883        "\n",884        "train_data = train_data.map(tokenize_and_encode_labels, batched=True)\n",885        "validation_data = validation_data.map(tokenize_and_encode_labels, batched=True)\n",886        "test_data = test_data.map(tokenize_and_encode_labels, batched=True)\n",887        "\n",888        "train_data.set_format(type='torch', columns=['input_ids', 'attention_mask', 'labels'])\n",889        "validation_data.set_format(type='torch', columns=['input_ids', 'attention_mask', 'labels'])\n",890        "test_data.set_format(type='torch', columns=['input_ids', 'attention_mask', 'labels'])\n",891        "\n",892        "# Load the model\n",893        "num_labels = len(mlb.classes_)\n",894        "model = BertForSequenceClassification.from_pretrained('bert-base-uncased', num_labels=num_labels, problem_type=\"multi_label_classification\")\n",895        "\n",896        "# Define training arguments\n",897        "training_args = TrainingArguments(\n",898        "    output_dir='./results',\n",899        "    num_train_epochs=3,\n",900        "    per_device_train_batch_size=16,\n",901        "    per_device_eval_batch_size=16,\n",902        "    warmup_steps=500,\n",903        "    weight_decay=0.01,\n",904        "    logging_dir='./logs',\n",905        "    logging_steps=10,\n",906        "    evaluation_strategy=\"epoch\"\n",907        ")\n",908        "\n",909        "# Define the compute metrics function\n",910        "def compute_metrics(pred):\n",911        "    labels = pred.label_ids\n",912        "    preds = (pred.predictions > 0.5).astype(float)  # Convert to float\n",913        "    precision, recall, f1, _ = precision_recall_fscore_support(labels, preds, average='micro')\n",914        "    acc = accuracy_score(labels, preds)\n",915        "    return {\n",916        "        'accuracy': acc,\n",917        "        'f1': f1,\n",918        "        'precision': precision,\n",919        "        'recall': recall\n",920        "    }\n",921        "\n",922        "# Initialize the Trainer\n",923        "trainer = Trainer(\n",924        "    model=model,\n",925        "    args=training_args,\n",926        "    train_dataset=train_data,\n",927        "    eval_dataset=validation_data,\n",928        "    compute_metrics=compute_metrics\n",929        ")\n",930        "\n",931        "# Train the model\n",932        "trainer.train()\n",933        "\n",934        "# Evaluate the model on validation data\n",935        "validation_results = trainer.evaluate(eval_dataset=validation_data)\n",936        "print(f\"Validation Accuracy: {validation_results['eval_accuracy']}\")\n",937        "\n",938        "# Evaluate the model on test data\n",939        "test_results = trainer.evaluate(eval_dataset=test_data)\n",940        "print(f\"Test Accuracy: {test_results['eval_accuracy']}\")\n",941        "\n",942        "# Save the model\n",943        "model.save_pretrained('./tos-bert-classifier')\n",944        "tokenizer.save_pretrained('./tos-bert-classifier')\n",945        "\n",946        "# Save the MultiLabelBinarizer\n",947        "import joblib\n",948        "joblib.dump(mlb, './tos-bert-classifier/mlb.joblib')"949      ]950    },951    {952      "cell_type": "code",953      "execution_count": null,954      "metadata": {955        "colab": {956          "base_uri": "https://localhost:8080/"957        },958        "id": "TLKmHjOne2XM",959        "outputId": "b7bd14ad-3fe4-46af-e31e-b9e534381d94"960      },961      "outputs": [962        {963          "name": "stdout",964          "output_type": "stream",965          "text": [966            "Enter a clause to classify (or 'quit' to exit): We reserve the right to suspend, terminate, or restrict your access to the platform at any time and for any reason, without prior notice or explanation. This includes but is not limited to violations of our community guidelines or terms of service, as determined solely by ConnectWorld.\n",967            "\n",968            "Predicted labels:\n",969            "a: 0.0418\n",970            "ch: 0.2703\n",971            "cr: 0.2862\n",972            "j: 0.0229\n",973            "law: 0.0394\n",974            "ltd: 0.1806\n",975            "pinc: 0.0391\n",976            "ter: 0.6514\n",977            "use: 0.0468\n",978            "\n",979            "Classified as:\n",980            "- ter\n",981            "\n",982            "Fairness level: potentially_unfair\n",983            "Unfair labels: ter\n",984            "\n",985            "Enter a clause to classify (or 'quit' to exit): You have the right to use CommunityConnect for its intended purpose of connecting with others, sharing content responsibly, and engaging in constructive dialogue. You are responsible for the content you post and must respect the rights and privacy of others.\n",986            "\n",987            "Predicted labels:\n",988            "a: 0.0026\n",989            "ch: 0.0041\n",990            "cr: 0.0028\n",991            "j: 0.0024\n",992            "law: 0.0025\n",993            "ltd: 0.0050\n",994            "pinc: 0.0032\n",995            "ter: 0.0038\n",996            "use: 0.0053\n",997            "\n",998            "Classified as:\n",999            "\n",1000            "Fairness level: clearly_fair\n",1001            "\n",1002            "Enter a clause to classify (or 'quit' to exit): 3. We are committed to protecting your privacy and personal information. We will not sell or share your data with third parties without your consent, except as required by law or as necessary to provide our services. Our privacy policy outlines how we collect, use, and protect your data.\n",1003            "\n",1004            "Predicted labels:\n",1005            "a: 0.0025\n",1006            "ch: 0.0042\n",1007            "cr: 0.0029\n",1008            "j: 0.0023\n",1009            "law: 0.0025\n",1010            "ltd: 0.0046\n",1011            "pinc: 0.0032\n",1012            "ter: 0.0041\n",1013            "use: 0.0050\n",1014            "\n",1015            "Classified as:\n",1016            "\n",1017            "Fairness level: clearly_fair\n",1018            "\n",1019            "Enter a clause to classify (or 'quit' to exit): ConnectWorld disclaims all warranties, whether express, implied, statutory, or otherwise, including but not limited to warranties of merchantability, fitness for a particular purpose, and non-infringement. We shall not be liable for any direct, indirect, incidental, special, consequential, or exemplary damages, including but not limited to loss of profits, goodwill, use, data, or other intangible losses, resulting from your use of the platform.\n",1020            "\n",1021            "Predicted labels:\n",1022            "a: 0.0282\n",1023            "ch: 0.0160\n",1024            "cr: 0.0216\n",1025            "j: 0.0150\n",1026            "law: 0.0206\n",1027            "ltd: 0.8346\n",1028            "pinc: 0.0165\n",1029            "ter: 0.0332\n",1030            "use: 0.0176\n",1031            "\n",1032            "Classified as:\n",1033            "- ltd\n",1034            "\n",1035            "Fairness level: potentially_unfair\n",1036            "Unfair labels: ltd\n",1037            "\n",1038            "Enter a clause to classify (or 'quit' to exit): Any disputes arising out of or relating to these terms or your use of the platform shall be resolved through binding arbitration administered by the ConnectWorld Arbitration Association. You waive your right to participate in class-action lawsuits or to bring claims against ConnectWorld in a court of law.\n",1039            "\n",1040            "Predicted labels:\n",1041            "a: 0.1775\n",1042            "ch: 0.0129\n",1043            "cr: 0.0170\n",1044            "j: 0.1556\n",1045            "law: 0.0637\n",1046            "ltd: 0.0508\n",1047            "pinc: 0.0168\n",1048            "ter: 0.0231\n",1049            "use: 0.0270\n",1050            "\n",1051            "Classified as:\n",1052            "\n",1053            "Fairness level: clearly_fair\n",1054            "\n",1055            "Enter a clause to classify (or 'quit' to exit): 2. You agree to indemnify and hold harmless ConnectWorld, its affiliates, and their respective officers, directors, employees, and agents from and against any and all claims, damages, obligations, losses, liabilities, costs, or debt, and expenses arising from your use of or access to the platform.\n",1056            "\n",1057            "Predicted labels:\n",1058            "a: 0.0025\n",1059            "ch: 0.0036\n",1060            "cr: 0.0030\n",1061            "j: 0.0022\n",1062            "law: 0.0023\n",1063            "ltd: 0.0069\n",1064            "pinc: 0.0028\n",1065            "ter: 0.0041\n",1066            "use: 0.0046\n",1067            "\n",1068            "Classified as:\n",1069            "\n",1070            "Fairness level: clearly_fair\n",1071            "\n",1072            "Enter a clause to classify (or 'quit' to exit): We reserve the right to suspend, terminate, or restrict your access to the platform at any time and for any reason, without prior notice or explanation. This includes but is not limited to violations of our community guidelines or terms of service, as determined solely by ConnectWorld.\n",1073            "\n",1074            "Predicted labels:\n",1075            "a: 0.0418\n",1076            "ch: 0.2703\n",1077            "cr: 0.2862\n",1078            "j: 0.0229\n",1079            "law: 0.0394\n",1080            "ltd: 0.1806\n",1081            "pinc: 0.0391\n",1082            "ter: 0.6514\n",1083            "use: 0.0468\n",1084            "\n",1085            "Classified as:\n",1086            "- ter\n",1087            "\n",1088            "Fairness level: potentially_unfair\n",1089            "Unfair labels: ter\n",1090            "\n",1091            "Enter a clause to classify (or 'quit' to exit): this means we may add new product features or enhancements from time to time as well as remove some features , and if these actions do not materially affect your rights or obligations , we may not provide you with notice before taking them.we may even suspend the services entirely , in which event we will notify you in advance unless extenuating circumstances , such as safety or security concerns , prevent us from doing so .\n",1092            "\n",1093            "Predicted labels:\n",1094            "a: 0.0262\n",1095            "ch: 0.4226\n",1096            "cr: 0.2555\n",1097            "j: 0.0197\n",1098            "law: 0.0281\n",1099            "ltd: 0.0360\n",1100            "pinc: 0.0242\n",1101            "ter: 0.4705\n",1102            "use: 0.0400\n",1103            "\n",1104            "Classified as:\n",1105            "\n",1106            "Fairness level: clearly_fair\n",1107            "\n",1108            "Enter a clause to classify (or 'quit' to exit): By accessing, browsing and using our (mobile) website or any of our applications through whatever platform (hereafter collectively referred to as the \"Platform\") and/or by completing a reservation, you acknowledge and agree to have read, understood and agreed to the terms and conditions set out below (including the privacy statement).\n",1109            "\n",1110            "Predicted labels:\n",1111            "a: 0.0394\n",1112            "ch: 0.1172\n",1113            "cr: 0.0443\n",1114            "j: 0.1001\n",1115            "law: 0.1282\n",1116            "ltd: 0.0177\n",1117            "pinc: 0.1632\n",1118            "ter: 0.0416\n",1119            "use: 0.2060\n",1120            "\n",1121            "Classified as:\n",1122            "\n",1123            "Fairness level: clearly_fair\n",1124            "\n",1125            "Enter a clause to classify (or 'quit' to exit): These terms and conditions, as may be amended from time to time, apply to all our services directly or indirectly (through distributors) made available online, through any mobile device, by email or by telephone.\n",1126            "\n",1127            "Predicted labels:\n",1128            "a: 0.0251\n",1129            "ch: 0.6233\n",1130            "cr: 0.1127\n",1131            "j: 0.0341\n",1132            "law: 0.0437\n",1133            "ltd: 0.0154\n",1134            "pinc: 0.0433\n",1135            "ter: 0.1559\n",1136            "use: 0.0760\n",1137            "\n",1138            "Classified as:\n",1139            "- ch\n",1140            "\n",1141            "Fairness level: potentially_unfair\n",1142            "Unfair labels: ch\n",1143            "\n",1144            "Enter a clause to classify (or 'quit' to exit): Although we will use reasonable skill and care in performing our Trip Service, we will not verify if, and cannot guarantee that, all information is accurate, complete or correct, nor can we be held responsible for any errors (including manifest and typographical errors), any interruptions (whether due to any (temporary and/or partial) breakdown, repair, upgrade or maintenance of our Platform or otherwise), inaccurate, misleading or untrue information or non-delivery of information.\n",1145            "\n",1146            "Predicted labels:\n",1147            "a: 0.0179\n",1148            "ch: 0.0127\n",1149            "cr: 0.0167\n",1150            "j: 0.0087\n",1151            "law: 0.0131\n",1152            "ltd: 0.7207\n",1153            "pinc: 0.0111\n",1154            "ter: 0.0269\n",1155            "use: 0.0127\n",1156            "\n",1157            "Classified as:\n",1158            "- ltd\n",1159            "\n",1160            "Fairness level: potentially_unfair\n",1161            "Unfair labels: ltd\n",1162            "\n",1163            "Enter a clause to classify (or 'quit' to exit): The Genius rate cannot be combined or used with other discounts (unless approved by the accommodation or indicated otherwise).\n",1164            "\n",1165            "Predicted labels:\n",1166            "a: 0.0026\n",1167            "ch: 0.0035\n",1168            "cr: 0.0029\n",1169            "j: 0.0022\n",1170            "law: 0.0023\n",1171            "ltd: 0.0063\n",1172            "pinc: 0.0028\n",1173            "ter: 0.0040\n",1174            "use: 0.0047\n",1175            "\n",1176            "Classified as:\n",1177            "\n",1178            "Fairness level: clearly_fair\n",1179            "\n",1180            "Enter a clause to classify (or 'quit' to exit): Booking.com may, at its discretion, (partially) alter, limit or modify the Genius programme structure or any other feature of the programme (including but not limited to the (status of the) subject Genius level(s)), for any reason, without prior notice.\n",1181            "\n",1182            "Predicted labels:\n",1183            "a: 0.0203\n",1184            "ch: 0.5931\n",1185            "cr: 0.1313\n",1186            "j: 0.0246\n",1187            "law: 0.0308\n",1188            "ltd: 0.0152\n",1189            "pinc: 0.0298\n",1190            "ter: 0.1789\n",1191            "use: 0.0569\n",1192            "\n",1193            "Classified as:\n",1194            "- ch\n",1195            "\n",1196            "Fairness level: potentially_unfair\n",1197            "Unfair labels: ch\n",1198            "\n",1199            "Enter a clause to classify (or 'quit' to exit): quit\n"1200          ]

Showing the first 1,200 of 9366 lines. Download the file for the rest.