diff --git "a/Code_for_training.ipynb" "b/Code_for_training.ipynb" deleted file mode 100644--- "a/Code_for_training.ipynb" +++ /dev/null @@ -1,5135 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "te5uCzPlhBWx" - }, - "source": [ - "# Processing the data (PyTorch)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "eiQ3FKJDhBW0" - }, - "source": [ - "Install the Transformers, Datasets, and Evaluate libraries to run this notebook." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "HedrkDuchBW2" - }, - "outputs": [], - "source": [ - "#let's install the necessary libraries from Hugging Face\n", - "!pip install datasets evaluate transformers[sentencepiece] transformers[torch]" - ] - }, - { - "cell_type": "code", - "source": [ - "from huggingface_hub import notebook_login\n", - "#authenticate into the huggin face\n", - "notebook_login()" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 145, - "referenced_widgets": [ - "2459586b900d4972893416101cf66518", - "bb63af0e6e2d44d39dea0c7fb50f2675", - "b84acaf57645444a93e8344e62b02f37", - "0adacec9605245e8813c1eb6c375f97c", - "3556f7c20dd942d9845a172d2fb3a308", - "c9c4f33186b34af5bfe4b23f5a94cd92", - "d9fce65fdc0f4f4e99511a95049b0627", - "1dfa79c17ca34ccb8a15887162536305", - "20b45c6e63d94306a2cd368e6dfc0719", - "7853cc389609486e9774a6327cbc6d7f", - "0bfa8f38be0c4d5e8b1a8f2a21623e2f", - "f363053a53f442379a9be069597c70dc", - "1c90fe7a114140a9b32d8107c2af011c", - "b45e9bbed2c34078813f4d8be11ba856", - "784ba2ebff4d451485ba312e0dd065e7", - "74757608b6d945b186ce03761a04a067", - "6f292a0a27234aaebaa90c47edbaa6bd", - "d35e9d78443840a6af111a3e3245184d", - "589080843ecd489488d86c10bc3c3d67", - "404e6261b69646be85dd78a0fb1dc3cc", - "adafd48f91e54326a4a5b2bb297e3d47", - "56a61a4c28de4eb9833e571d4067c4c4", - "954f23b0ee9249df81dd30725c9954b0", - "ec75914e1c264260a9f573728880474a", - "e998f2b2d75d4f3887c59669603793df", - "eea3bf1ec05c4ba28cd5f1baa44bcfd8", - "1b22a95ee6ff4fdca56a966d35c46ddf", - "83c197270ac54969af02fa998fec28f1", - "21453473c9f04ef992fe35419f6afff9", - "3980e52353a14d538c1dc4b1b45d1396", - "1fa7b92f0588403bb146f602942baea6", - "20169140dbe04320b1a7d090d738f273" - ] - }, - "id": "Z4IolwVzaQQh", - "outputId": "7f4c4beb-0cdf-4549-cfb9-6496f50c7118" - }, - "execution_count": 137, - "outputs": [ - { - "output_type": "display_data", - "data": { - "text/plain": [ - "VBox(children=(HTML(value='
Epoch | \n", - "Training Loss | \n", - "Validation Loss | \n", - "Accuracy | \n", - "Precision | \n", - "Recall | \n", - "F1 | \n", - "
---|---|---|---|---|---|---|
1 | \n", - "No log | \n", - "1.137511 | \n", - "0.774704 | \n", - "0.730148 | \n", - "0.774704 | \n", - "0.744985 | \n", - "
2 | \n", - "No log | \n", - "0.559548 | \n", - "0.885375 | \n", - "0.867484 | \n", - "0.885375 | \n", - "0.872829 | \n", - "
3 | \n", - "No log | \n", - "0.430789 | \n", - "0.920949 | \n", - "0.906086 | \n", - "0.920949 | \n", - "0.910576 | \n", - "
" - ] - }, - "metadata": {} - }, - { - "output_type": "stream", - "name": "stderr", - "text": [ - "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n", - " _warn_prf(average, modifier, msg_start, len(result))\n", - "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n", - " _warn_prf(average, modifier, msg_start, len(result))\n", - "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n", - " _warn_prf(average, modifier, msg_start, len(result))\n" - ] - }, - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "TrainOutput(global_step=339, training_loss=1.01418788313514, metrics={'train_runtime': 138.9845, 'train_samples_per_second': 19.513, 'train_steps_per_second': 2.439, 'total_flos': 245512156913712.0, 'train_loss': 1.01418788313514, 'epoch': 3.0})" - ] - }, - "metadata": {}, - "execution_count": 142 - } - ] - }, - { - "cell_type": "code", - "source": [ - "#it's good. Let's push the model to the hugging face hub\n", - "trainer.push_to_hub()" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 70 - }, - "id": "DxFz2gWSMUI6", - "outputId": "9e83f368-3084-4168-c828-1665b934e769" - }, - "execution_count": 143, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": [ - "CommitInfo(commit_url='https://huggingface.co/Marcuswas/bert-drug-review-to-condition/commit/d6f99808a6fad08574389e154a44694bbd24ad5d', commit_message='End of training', commit_description='', oid='d6f99808a6fad08574389e154a44694bbd24ad5d', pr_url=None, pr_revision=None, pr_num=None)" - ], - "application/vnd.google.colaboratory.intrinsic+json": { - "type": "string" - } - }, - "metadata": {}, - "execution_count": 143 - } - ] - } - ], - "metadata": { - "colab": { - "provenance": [], - "gpuType": "T4" - }, - "language_info": { - "name": "python" - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "2459586b900d4972893416101cf66518": { - "model_module": "@jupyter-widgets/controls", - "model_name": "VBoxModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "VBoxModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "VBoxView", - "box_style": "", - "children": [ - "IPY_MODEL_adafd48f91e54326a4a5b2bb297e3d47", - "IPY_MODEL_56a61a4c28de4eb9833e571d4067c4c4", - "IPY_MODEL_954f23b0ee9249df81dd30725c9954b0", - "IPY_MODEL_ec75914e1c264260a9f573728880474a" - ], - "layout": "IPY_MODEL_d9fce65fdc0f4f4e99511a95049b0627" - } - }, - "bb63af0e6e2d44d39dea0c7fb50f2675": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_dom_classes": [], - "_model_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_model_name": "HTMLModel", - "_view_count": null, - "_view_module": "@jupyter-widgets/controls", - "_view_module_version": "1.5.0", - "_view_name": "HTMLView", - "description": "", - "description_tooltip": null, - "layout": "IPY_MODEL_1dfa79c17ca34ccb8a15887162536305", - "placeholder": "", - "style": "IPY_MODEL_20b45c6e63d94306a2cd368e6dfc0719", - "value": "