{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4", "mount_file_id": "1npJ_m9j344UPF9JAmHTQ-_k6aMVugCpk", "authorship_tag": "ABX9TyM0uPiqoelXhWIVmGBY/QDu", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU" }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "R_OdgWC3J90I", "outputId": "798bca08-f949-4c70-e6d2-cd28f020492b" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "/content/drive/MyDrive\n" ] } ], "source": [ "%cd .." ] }, { "cell_type": "code", "source": [ "!rm -rf toxic_comment_moderator_api" ], "metadata": { "id": "QUk1Q6CEi4HD" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "!git clone https://github.com/lloydakresi/toxic_comment_moderator_api.git" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Sp0Up667g4Xy", "outputId": "b21c7fd0-f539-42e1-992b-0ab8392a52ec" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Cloning into 'toxic_comment_moderator_api'...\n", "remote: Enumerating objects: 49, done.\u001b[K\n", "remote: Counting objects: 100% (49/49), done.\u001b[K\n", "remote: Compressing objects: 100% (28/28), done.\u001b[K\n", "remote: Total 49 (delta 23), reused 45 (delta 19), pack-reused 0 (from 0)\u001b[K\n", "Receiving objects: 100% (49/49), 32.99 KiB | 3.67 MiB/s, done.\n", "Resolving deltas: 100% (23/23), done.\n" ] } ] }, { "cell_type": "code", "source": [ "%cd toxic_comment_moderator_api" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "XzFpM_OThNor", "outputId": "e646206d-06b4-4bd5-c06d-059604892416" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "/content/drive/MyDrive/toxic_comment_moderator_api\n" ] } ] }, { "cell_type": "code", "source": [ "!pip install transformers==5.12.1 datasets==5.0.0 evaluate==0.4.6 accelerate==1.14.0 scikit-learn==1.9.0 iterative-stratification==0.1.9 -q" ], "metadata": { "id": "GscPa1Bihx9H" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "!python train.py" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "LBmM7I26imWc", "outputId": "bd9c3a9f-d3f8-41f3-f09f-c0c0f9986293" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "['id', 'comment_text', 'toxic', 'severe_toxic', 'obscene', 'threat', 'insult', 'identity_hate']\n", "143613\n", "Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.\n", "Map: 100% 143613/143613 [00:43<00:00, 3280.74 examples/s]\n", "Map: 100% 15958/15958 [00:05<00:00, 2756.07 examples/s]\n", "Loading weights: 100% 100/100 [00:00<00:00, 5538.28it/s]\n", "[transformers] \u001b[1mDistilBertForSequenceClassification LOAD REPORT\u001b[0m from: distilbert-base-uncased\n", "Key | Status | \n", "------------------------+------------+-\n", "vocab_layer_norm.bias | \u001b[38;5;208mUNEXPECTED\u001b[0m | \n", "vocab_transform.bias | \u001b[38;5;208mUNEXPECTED\u001b[0m | \n", "vocab_transform.weight | \u001b[38;5;208mUNEXPECTED\u001b[0m | \n", "vocab_projector.bias | \u001b[38;5;208mUNEXPECTED\u001b[0m | \n", "vocab_layer_norm.weight | \u001b[38;5;208mUNEXPECTED\u001b[0m | \n", "pre_classifier.bias | \u001b[31mMISSING\u001b[0m | \n", "pre_classifier.weight | \u001b[31mMISSING\u001b[0m | \n", "classifier.bias | \u001b[31mMISSING\u001b[0m | \n", "classifier.weight | \u001b[31mMISSING\u001b[0m | \n", "\n", "Notes:\n", "- \u001b[38;5;208mUNEXPECTED:\u001b[0m\t\u001b[3mcan be ignored when loading from different task/architecture; not ok if you expect identical arch.\u001b[0m\n", "- \u001b[31mMISSING:\u001b[0m\t\u001b[3mthose params were newly initialized because missing from the checkpoint. Consider training on your downstream task.\u001b[0m\n", "True\n", "Tesla T4\n", "Model device: cuda:0\n", " 3% 391/11220 [19:08<8:13:13, 2.73s/it]" ] } ] } ] }