{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "X4cRE8IbIrIV" }, "source": [ "If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers and 🤗 Datasets as well as other dependencies. Uncomment the following cell and run it." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "MOsHUjgdIrIW", "outputId": "d4af45da-df5e-49d5-e0d6-be54e0f9ad1f" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: datasets in /usr/local/lib/python3.10/dist-packages (2.13.1)\n", "Requirement already satisfied: evaluate in /usr/local/lib/python3.10/dist-packages (0.4.0)\n", "Requirement already satisfied: transformers in /usr/local/lib/python3.10/dist-packages (4.30.2)\n", "Requirement already satisfied: rouge-score in /usr/local/lib/python3.10/dist-packages (0.1.2)\n", "Requirement already satisfied: nltk in /usr/local/lib/python3.10/dist-packages (3.8.1)\n", "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from datasets) (1.22.4)\n", "Requirement already satisfied: pyarrow>=8.0.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (9.0.0)\n", "Requirement already satisfied: dill<0.3.7,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (0.3.6)\n", "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from datasets) (1.5.3)\n", "Requirement already satisfied: requests>=2.19.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (2.27.1)\n", "Requirement already satisfied: tqdm>=4.62.1 in /usr/local/lib/python3.10/dist-packages (from datasets) (4.65.0)\n", "Requirement already satisfied: xxhash in /usr/local/lib/python3.10/dist-packages (from datasets) (3.2.0)\n", "Requirement already satisfied: multiprocess in /usr/local/lib/python3.10/dist-packages (from datasets) (0.70.14)\n", "Requirement already satisfied: fsspec[http]>=2021.11.1 in /usr/local/lib/python3.10/dist-packages (from datasets) (2023.6.0)\n", "Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from datasets) (3.8.4)\n", "Requirement already satisfied: huggingface-hub<1.0.0,>=0.11.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (0.16.3)\n", "Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from datasets) (23.1)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from datasets) (6.0)\n", "Requirement already satisfied: responses<0.19 in /usr/local/lib/python3.10/dist-packages (from evaluate) (0.18.0)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers) (3.12.2)\n", "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2022.10.31)\n", "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.13.3)\n", "Requirement already satisfied: safetensors>=0.3.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.3.1)\n", "Requirement already satisfied: absl-py in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.4.0)\n", "Requirement already satisfied: six>=1.14.0 in /usr/local/lib/python3.10/dist-packages (from rouge-score) (1.16.0)\n", "Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from nltk) (8.1.3)\n", "Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk) (1.2.0)\n", "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (23.1.0)\n", "Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (2.0.12)\n", "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (6.0.4)\n", "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (4.0.2)\n", "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.9.2)\n", "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.3.3)\n", "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.3.1)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0.0,>=0.11.0->datasets) (4.6.3)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->datasets) (1.26.16)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->datasets) (2023.5.7)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->datasets) (3.4)\n", "Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2.8.2)\n", "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2022.7.1)\n" ] } ], "source": [ "! pip install datasets evaluate transformers rouge-score nltk" ] }, { "cell_type": "code", "source": [ "! pip install huggingface_hub" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "mRzDQvi2SWxZ", "outputId": "831331b8-4020-40f3-bbdd-1c373652862d" }, "execution_count": 3, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: huggingface_hub in /usr/local/lib/python3.10/dist-packages (0.16.3)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (3.12.2)\n", "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2023.6.0)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (2.27.1)\n", "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.65.0)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (6.0)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (4.6.3)\n", "Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.10/dist-packages (from huggingface_hub) (23.1)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (1.26.16)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2023.5.7)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (2.0.12)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface_hub) (3.4)\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "t4_p3GTW1wfY" }, "source": [ "If you're opening this notebook locally, make sure your environment has an install from the last version of those libraries.\n", "\n", "To be able to share your model with the community and generate results like the one shown in the picture below via the inference API, there are a few more steps to follow.\n", "\n", "First you have to store your authentication token from the Hugging Face website (sign up [here](https://huggingface.co/join) if you haven't already!) then execute the following cell and input your username and password:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 162, "referenced_widgets": [ "9c59ace7d7414de39bd9089106d40b61", "b6c0102a743a4dc6a8f0d31a8782fc3a", "5a5362b4027f47519979c90f378ed3f8", "8662568bfce34d2daa3667930e9149bb", "5fd77d6f9da048bb89ff4404a432bc8d", "bf4cb6dd78bc49739a154bd5eace0845", "56d6e462c2d646f2b105f097516042a9", "35dd514732cf40a3ac05f7318eba5554", "32244a1998c743ae8247816d43898b03", "04cdfd25912b4019ab62fe2dcad9daa0", "e2600a5469ed421ca2c55ad4f2df45c5", "aa30bb4feb3c48f59730e9860efec395", "21d7542ea2eb4b7c9d2a3cc44c61db08", "6f9d30b9189b4e5ea5afce58a82975b2", "32fdad1696134a67a1166db3c24b3afc", "70cb135100be4181a347ec64cc8d4964", "5a80a61eea6343eabb6d895afaf4184a", "23c71a29a5644ce39f503f440c950c4d", "46e519b3a1dd41fa84a8195985040c52", "c412910f38f34e50b9c8d8853b516864", "67cc4396a3294d8382dc50cff50fe4b2", "ccca9f0e47ae42ee9a66de68f4776374", "e0a18363d20448b899b205fc7cca40cb", "801da6de33c94c42a8abf3d43472be87", "222bfc5456184d9ebf59c6e223c16b9b", "c22465dd6ad54749bf20dd2f2d9ae325", "4cf75ce535f74ff39ec7e6d5fb92dbef", "9ce113695cc34621b95c97df5276a3d7", "bc70c29aca694266b90c71415e8cd086", "3b66ed358dca41149c1679d5ddabe9d2", "a7a1bf64fb7347f2b997abff3068d0aa", "fc0f6ef8302d4d91bc1e240ba1ead27e" ] }, "id": "x6KMIohU1wfZ", "outputId": "71895d8a-b082-48ff-c16d-3a7ed503f2e0" }, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "VBox(children=(HTML(value='
=0.14.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.16.3)\n", "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (1.22.4)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (23.1)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (6.0)\n", "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2022.10.31)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers) (2.27.1)\n", "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.13.3)\n", "Requirement already satisfied: safetensors>=0.3.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.3.1)\n", "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.10/dist-packages (from transformers) (4.65.0)\n", "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers) (2023.6.0)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers) (4.6.3)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (1.26.16)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2023.5.7)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2.0.12)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.4)\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "HFASsisvIrIb" }, "source": [ "You can find a script version of this notebook to fine-tune your model in a distributed fashion using multiple GPUs or TPUs [here](https://github.com/huggingface/transformers/tree/master/examples/seq2seq)." ] }, { "cell_type": "markdown", "metadata": { "id": "av_isXDk1wfe" }, "source": [ "We also quickly upload some telemetry - this tells us which examples and software versions are getting used so we know where to prioritize our maintenance efforts. We don't collect (or care about) any personally identifiable information, but if you'd prefer not to be counted, feel free to skip this step or delete this cell entirely." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "id": "fEDt5wWX1wff" }, "outputs": [], "source": [ "from transformers.utils import send_example_telemetry\n", "\n", "send_example_telemetry(\"summarization_notebook\", framework=\"pytorch\")" ] }, { "cell_type": "markdown", "metadata": { "id": "rEJBSTyZIrIb" }, "source": [ "# Fine-tuning a model on a summarization task" ] }, { "cell_type": "markdown", "metadata": { "id": "kTCFado4IrIc" }, "source": [ "In this notebook, we will see how to fine-tune one of the [🤗 Transformers](https://github.com/huggingface/transformers) model for a summarization task. We will use the [XSum dataset](https://arxiv.org/pdf/1808.08745.pdf) (for extreme summarization) which contains BBC articles accompanied with single-sentence summaries.\n", "\n", "![Widget inference on a summarization task](https://github.com/huggingface/notebooks/blob/main/examples/images/summarization.png?raw=1)\n", "\n", "We will see how to easily load the dataset for this task using 🤗 Datasets and how to fine-tune a model on it using the `Trainer` API." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "id": "oovxMTaR1wfg" }, "outputs": [], "source": [ "model_checkpoint = \"t5-small\"" ] }, { "cell_type": "markdown", "metadata": { "id": "4RRkXuteIrIh" }, "source": [ "This notebook is built to run with any model checkpoint from the [Model Hub](https://huggingface.co/models) as long as that model has a sequence-to-sequence version in the Transformers library. Here we picked the [`t5-small`](https://huggingface.co/t5-small) checkpoint." ] }, { "cell_type": "markdown", "metadata": { "id": "whPRbBNbIrIl" }, "source": [ "## Loading the dataset" ] }, { "cell_type": "markdown", "metadata": { "id": "W7QYTpxXIrIl" }, "source": [ "We will use the [🤗 Datasets](https://github.com/huggingface/datasets) library to download the data and get the metric we need to use for evaluation (to compare our model to the benchmark). This can be easily done with the functions `load_dataset` and `load_metric`. " ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "id": "IreSlFmlIrIm", "colab": { "base_uri": "https://localhost:8080/", "height": 86, "referenced_widgets": [ "a5a5d838de2d4943b277bb2f0e739bf0", "37337c451874401db25fb882c1ae9dfa", "9871729cde1942808cd8724400282c0b", "3706f03cef3e4c7b83abd17301a9a95e", "e4856bc29e104eb1b352deca30cc6ad0", "d1f70639afb14aa68289e202622bcb07", "c3feac419c3442408fb0ed2410616fe8", "99cea22d6755472faed2975832b19907", "77906a41d8ce4d91b9cc52f0b91310de", "8a08f78829c5488ead2a1dcfd75b5765", "1fd2fccec79645e2b0a50cae106f0e7c" ] }, "outputId": "b836dd47-39c0-4b65-9081-cb450600e9de" }, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "WARNING:datasets.builder:Found cached dataset xsum (/root/.cache/huggingface/datasets/xsum/default/1.2.0/082863bf4754ee058a5b6f6525d0cb2b18eadb62c7b370b095d1364050a52b71)\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ " 0%| | 0/3 [00:00>> rouge = evaluate.load('rouge')\n", " >>> predictions = [\"hello there\", \"general kenobi\"]\n", " >>> references = [\"hello there\", \"general kenobi\"]\n", " >>> results = rouge.compute(predictions=predictions, references=references)\n", " >>> print(results)\n", " {'rouge1': 1.0, 'rouge2': 1.0, 'rougeL': 1.0, 'rougeLsum': 1.0}\n", "\"\"\", stored examples: 0)" ] }, "metadata": {}, "execution_count": 15 } ], "source": [ "metric" ] }, { "cell_type": "markdown", "metadata": { "id": "jAWdqcUBIrJC" }, "source": [ "You can call its `compute` method with your predictions and labels, which need to be list of decoded strings:" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "id": "6XN1Rq0aIrJC", "outputId": "5dab54af-f770-45c4-f9dc-2e61b5b27d1c", "colab": { "base_uri": "https://localhost:8080/" } }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "{'rouge1': 1.0, 'rouge2': 1.0, 'rougeL': 1.0, 'rougeLsum': 1.0}" ] }, "metadata": {}, "execution_count": 16 } ], "source": [ "fake_preds = [\"hello there\", \"general kenobi\"]\n", "fake_labels = [\"hello there\", \"general kenobi\"]\n", "metric.compute(predictions=fake_preds, references=fake_labels)" ] }, { "cell_type": "markdown", "metadata": { "id": "n9qywopnIrJH" }, "source": [ "## Preprocessing the data" ] }, { "cell_type": "markdown", "metadata": { "id": "YVx71GdAIrJH" }, "source": [ "Before we can feed those texts to our model, we need to preprocess them. This is done by a 🤗 Transformers `Tokenizer` which will (as the name indicates) tokenize the inputs (including converting the tokens to their corresponding IDs in the pretrained vocabulary) and put it in a format the model expects, as well as generate the other inputs that the model requires.\n", "\n", "To do all of this, we instantiate our tokenizer with the `AutoTokenizer.from_pretrained` method, which will ensure:\n", "\n", "- we get a tokenizer that corresponds to the model architecture we want to use,\n", "- we download the vocabulary used when pretraining this specific checkpoint.\n", "\n", "That vocabulary will be cached, so it's not downloaded again the next time we run the cell." ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "id": "eXNLu_-nIrJI" }, "outputs": [], "source": [ "from transformers import AutoTokenizer\n", "\n", "tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)" ] }, { "cell_type": "markdown", "metadata": { "id": "Vl6IidfdIrJK" }, "source": [ "By default, the call above will use one of the fast tokenizers (backed by Rust) from the 🤗 Tokenizers library." ] }, { "cell_type": "markdown", "metadata": { "id": "rowT4iCLIrJK" }, "source": [ "You can directly call this tokenizer on one sentence or a pair of sentences:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "id": "a5hBlsrHIrJL", "outputId": "0fc4adb5-e053-40a8-cb89-37b0e4c2be1f", "colab": { "base_uri": "https://localhost:8080/" } }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "{'input_ids': [8774, 6, 48, 80, 7142, 55, 1], 'attention_mask': [1, 1, 1, 1, 1, 1, 1]}" ] }, "metadata": {}, "execution_count": 18 } ], "source": [ "tokenizer(\"Hello, this one sentence!\")" ] }, { "cell_type": "markdown", "metadata": { "id": "qo_0B1M2IrJM" }, "source": [ "Depending on the model you selected, you will see different keys in the dictionary returned by the cell above. They don't matter much for what we're doing here (just know they are required by the model we will instantiate later), you can learn more about them in [this tutorial](https://huggingface.co/transformers/preprocessing.html) if you're interested.\n", "\n", "Instead of one sentence, we can pass along a list of sentences:" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "RP8NEcDw1wfn", "outputId": "695c4e8e-8eeb-46cc-be66-7d30f9fdfce2" }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "{'input_ids': [[8774, 6, 48, 80, 7142, 55, 1], [100, 19, 430, 7142, 5, 1]], 'attention_mask': [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]}" ] }, "metadata": {}, "execution_count": 19 } ], "source": [ "tokenizer([\"Hello, this one sentence!\", \"This is another sentence.\"])" ] }, { "cell_type": "markdown", "metadata": { "id": "gCep6T6p1wfn" }, "source": [ "To prepare the targets for our model, we need to tokenize them using the `text_target` parameter. This will make sure the tokenizer uses the special tokens corresponding to the targets:" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "2SjOkOGE1wfn", "outputId": "141f5f56-49c1-409b-a3a5-cabec13d04f8" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "{'input_ids': [[8774, 6, 48, 80, 7142, 55, 1], [100, 19, 430, 7142, 5, 1]], 'attention_mask': [[1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]}\n" ] } ], "source": [ "print(tokenizer(text_target=[\"Hello, this one sentence!\", \"This is another sentence.\"]))" ] }, { "cell_type": "markdown", "metadata": { "id": "2C0hcmp9IrJQ" }, "source": [ "If you are using one of the five T5 checkpoints we have to prefix the inputs with \"summarize:\" (the model can also translate and it needs the prefix to know which task it has to perform)." ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "id": "F_jcCP4n1wfs" }, "outputs": [], "source": [ "if model_checkpoint in [\"t5-small\", \"t5-base\", \"t5-larg\", \"t5-3b\", \"t5-11b\"]:\n", " prefix = \"summarize: \"\n", "else:\n", " prefix = \"\"" ] }, { "cell_type": "markdown", "metadata": { "id": "5pYYnyND1wfs" }, "source": [ "We can then write the function that will preprocess our samples. We just feed them to the `tokenizer` with the argument `truncation=True`. This will ensure that an input longer that what the model selected can handle will be truncated to the maximum length accepted by the model. The padding will be dealt with later on (in a data collator) so we pad examples to the longest length in the batch and not the whole dataset." ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "id": "vc0BSBLIIrJQ" }, "outputs": [], "source": [ "max_input_length = 1024\n", "max_target_length = 128\n", "\n", "def preprocess_function(examples):\n", " inputs = [prefix + doc for doc in examples[\"document\"]]\n", " model_inputs = tokenizer(inputs, max_length=max_input_length, truncation=True)\n", "\n", " # Setup the tokenizer for targets\n", " labels = tokenizer(text_target=examples[\"summary\"], max_length=max_target_length, truncation=True)\n", "\n", " model_inputs[\"labels\"] = labels[\"input_ids\"]\n", " return model_inputs" ] }, { "cell_type": "markdown", "metadata": { "id": "0lm8ozrJIrJR" }, "source": [ "This function works with one or several examples. In the case of several examples, the tokenizer will return a list of lists for each key:" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "id": "-b70jh26IrJS", "outputId": "be82a796-f158-464b-c029-adc92b271cb5", "colab": { "base_uri": "https://localhost:8080/" } }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "{'input_ids': [[21603, 10, 37, 423, 583, 13, 1783, 16, 20126, 16496, 6, 80, 13, 8, 844, 6025, 4161, 6, 19, 341, 271, 14841, 5, 7057, 161, 19, 4912, 16, 1626, 5981, 11, 186, 7540, 16, 1276, 15, 2296, 7, 5718, 2367, 14621, 4161, 57, 4125, 387, 5, 15059, 7, 30, 8, 4653, 4939, 711, 747, 522, 17879, 788, 12, 1783, 44, 8, 15763, 6029, 1813, 9, 7472, 5, 1404, 1623, 11, 5699, 277, 130, 4161, 57, 18368, 16, 20126, 16496, 227, 8, 2473, 5895, 15, 147, 89, 22411, 139, 8, 1511, 5, 1485, 3271, 3, 21926, 9, 472, 19623, 5251, 8, 616, 12, 15614, 8, 1783, 5, 37, 13818, 10564, 15, 26, 3, 9, 3, 19513, 1481, 6, 18368, 186, 1328, 2605, 30, 7488, 1887, 3, 18, 8, 711, 2309, 9517, 89, 355, 5, 3966, 1954, 9233, 15, 6, 113, 293, 7, 8, 16548, 13363, 106, 14022, 84, 47, 14621, 4161, 6, 243, 255, 228, 59, 7828, 8, 1249, 18, 545, 11298, 1773, 728, 8, 8347, 1560, 5, 611, 6, 255, 243, 72, 1709, 1528, 161, 228, 43, 118, 4006, 91, 12, 766, 8, 3, 19513, 1481, 410, 59, 5124, 5, 96, 196, 17, 19, 1256, 68, 27, 103, 317, 132, 19, 78, 231, 23546, 21, 970, 51, 89, 2593, 11, 8, 2504, 189, 3, 18, 11, 27, 3536, 3653, 24, 3, 18, 68, 34, 19, 966, 114, 62, 31, 60, 23708, 42, 11821, 976, 255, 243, 5, 96, 11880, 164, 59, 36, 1176, 68, 34, 19, 2361, 82, 3503, 147, 8, 336, 360, 477, 5, 96, 17891, 130, 25, 59, 1065, 12, 199, 178, 3, 9, 720, 72, 116, 8, 6337, 11, 8, 6196, 5685, 7, 141, 2767, 91, 4609, 7940, 6, 3, 9, 8347, 5685, 3048, 16, 286, 640, 8, 17600, 7, 250, 13, 8, 3917, 3412, 5, 1276, 15, 2296, 7, 47, 14621, 1560, 57, 982, 6, 13233, 53, 3088, 12, 4277, 72, 13613, 7, 16, 8, 616, 5, 12580, 17600, 7, 2063, 65, 474, 3, 9, 570, 30, 165, 475, 13, 8, 7540, 6025, 4161, 11, 3863, 43, 118, 3, 19492, 59, 12, 9751, 12493, 3957, 5, 37, 16117, 3450, 31, 7, 21108, 12580, 2488, 5104, 11768, 1306, 47, 16, 1626, 5981, 30, 2089, 12, 217, 8, 1419, 166, 609, 5, 216, 243, 34, 47, 359, 12, 129, 8, 8347, 1711, 515, 269, 68, 3, 9485, 3088, 12, 1634, 95, 8, 433, 5, 96, 196, 47, 882, 1026, 3, 9, 1549, 57, 8, 866, 13, 1783, 24, 65, 118, 612, 976, 3, 88, 243, 5, 96, 14116, 34, 19, 842, 18, 18087, 21, 151, 113, 43, 118, 5241, 91, 13, 70, 2503, 11, 8, 1113, 30, 1623, 535, 216, 243, 34, 47, 359, 24, 96, 603, 5700, 342, 2245, 121, 130, 1026, 12, 1822, 8, 844, 167, 9930, 11, 3, 9, 964, 97, 3869, 474, 16, 286, 21, 8347, 9793, 1390, 5, 2114, 25, 118, 4161, 57, 18368, 16, 970, 51, 89, 2593, 11, 10987, 32, 1343, 42, 8, 17600, 7, 58, 8779, 178, 81, 39, 351, 13, 8, 1419, 11, 149, 34, 47, 10298, 5, 8601, 178, 30, 142, 40, 157, 12546, 5, 15808, 1741, 115, 115, 75, 5, 509, 5, 1598, 42, 146, 51, 89, 2593, 1741, 115, 115, 75, 5, 509, 5, 1598, 5, 1], [21603, 10, 71, 1472, 6196, 877, 326, 44, 8, 9108, 86, 29, 16, 6000, 1887, 44, 81, 11484, 10, 1755, 272, 4209, 30, 1856, 11, 2554, 130, 1380, 12, 1175, 8, 1595, 5, 282, 79, 3, 9094, 1067, 79, 1509, 8, 192, 14264, 6, 3, 16669, 596, 18, 969, 18, 1583, 16, 8, 443, 2447, 6, 3, 35, 6106, 19565, 57, 12314, 7, 5, 555, 13, 8, 1552, 1637, 19, 45, 3434, 6, 8, 119, 45, 1473, 11, 14441, 5, 94, 47, 70, 166, 706, 16, 5961, 5316, 5, 37, 2535, 13, 80, 13, 8, 14264, 243, 186, 13, 8, 9234, 141, 646, 525, 12770, 7, 30, 1476, 11, 175, 141, 118, 10932, 5, 2867, 1637, 43, 13666, 3709, 11210, 11, 56, 1731, 70, 1552, 13, 8, 3457, 4939, 865, 145, 79, 141, 4355, 5, 5076, 43, 3958, 15, 26, 21, 251, 81, 8, 3211, 5, 86, 7, 102, 1955, 24723, 243, 10, 96, 196, 17, 3475, 38, 713, 8, 1472, 708, 365, 80, 13, 8, 14264, 274, 16436, 12, 8, 511, 5, 96, 27674, 8, 2883, 1137, 19, 341, 365, 4962, 6, 34, 19, 816, 24, 8, 1472, 47, 708, 24067, 535, 1]], 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], 'labels': [[7433, 18, 413, 2673, 33, 6168, 640, 8, 12580, 17600, 7, 11, 970, 51, 89, 2593, 11, 10987, 32, 1343, 227, 18368, 2953, 57, 16133, 4937, 5, 1], [2759, 8548, 14264, 43, 118, 10932, 57, 1472, 16, 3, 9, 18024, 1584, 739, 3211, 16, 27874, 690, 2050, 5, 1]]}" ] }, "metadata": {}, "execution_count": 23 } ], "source": [ "preprocess_function(raw_datasets['train'][:2])" ] }, { "cell_type": "markdown", "metadata": { "id": "zS-6iXTkIrJT" }, "source": [ "To apply this function on all the pairs of sentences in our dataset, we just use the `map` method of our `dataset` object we created earlier. This will apply the function on all the elements of all the splits in `dataset`, so our training, validation and testing data will be preprocessed in one single command." ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "id": "DDtsaJeVIrJT", "outputId": "dcd93f90-5543-44b6-ecc2-ed5518c968d3", "colab": { "base_uri": "https://localhost:8080/" } }, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "WARNING:datasets.arrow_dataset:Loading cached processed dataset at /root/.cache/huggingface/datasets/xsum/default/1.2.0/082863bf4754ee058a5b6f6525d0cb2b18eadb62c7b370b095d1364050a52b71/cache-c5da3591f8a561b9.arrow\n", "WARNING:datasets.arrow_dataset:Loading cached processed dataset at /root/.cache/huggingface/datasets/xsum/default/1.2.0/082863bf4754ee058a5b6f6525d0cb2b18eadb62c7b370b095d1364050a52b71/cache-780593aeb3646751.arrow\n", "WARNING:datasets.arrow_dataset:Loading cached processed dataset at /root/.cache/huggingface/datasets/xsum/default/1.2.0/082863bf4754ee058a5b6f6525d0cb2b18eadb62c7b370b095d1364050a52b71/cache-220aae4d0a3c4e03.arrow\n" ] } ], "source": [ "tokenized_datasets = raw_datasets.map(preprocess_function, batched=True)" ] }, { "cell_type": "markdown", "metadata": { "id": "voWiw8C7IrJV" }, "source": [ "Even better, the results are automatically cached by the 🤗 Datasets library to avoid spending time on this step the next time you run your notebook. The 🤗 Datasets library is normally smart enough to detect when the function you pass to map has changed (and thus requires to not use the cache data). For instance, it will properly detect if you change the task in the first cell and rerun the notebook. 🤗 Datasets warns you when it uses cached files, you can pass `load_from_cache_file=False` in the call to `map` to not use the cached files and force the preprocessing to be applied again.\n", "\n", "Note that we passed `batched=True` to encode the texts by batches together. This is to leverage the full benefit of the fast tokenizer we loaded earlier, which will use multi-threading to treat the texts in a batch concurrently." ] }, { "cell_type": "markdown", "metadata": { "id": "545PP3o8IrJV" }, "source": [ "## Fine-tuning the model" ] }, { "cell_type": "markdown", "metadata": { "id": "FBiW8UpKIrJW" }, "source": [ "Now that our data is ready, we can download the pretrained model and fine-tune it. Since our task is of the sequence-to-sequence kind, we use the `AutoModelForSeq2SeqLM` class. Like with the tokenizer, the `from_pretrained` method will download and cache the model for us." ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "id": "TlqNaB8jIrJW" }, "outputs": [], "source": [ "from transformers import AutoModelForSeq2SeqLM, DataCollatorForSeq2Seq, Seq2SeqTrainingArguments, Seq2SeqTrainer\n", "\n", "model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)" ] }, { "cell_type": "code", "source": [ "! pip install transformers[torch]" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "kj6_0PVrXOyi", "outputId": "fdb654b2-f03f-4318-b49c-3e39becaa83e" }, "execution_count": 26, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: transformers[torch] in /usr/local/lib/python3.10/dist-packages (4.30.2)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (3.12.2)\n", "Requirement already satisfied: huggingface-hub<1.0,>=0.14.1 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (0.16.3)\n", "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (1.22.4)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (23.1)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (6.0)\n", "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (2022.10.31)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (2.27.1)\n", "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (0.13.3)\n", "Requirement already satisfied: safetensors>=0.3.1 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (0.3.1)\n", "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (4.65.0)\n", "Requirement already satisfied: torch!=1.12.0,>=1.9 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (2.0.1+cu118)\n", "Requirement already satisfied: accelerate>=0.20.2 in /usr/local/lib/python3.10/dist-packages (from transformers[torch]) (0.20.3)\n", "Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from accelerate>=0.20.2->transformers[torch]) (5.9.5)\n", "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers[torch]) (2023.6.0)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers[torch]) (4.6.3)\n", "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch!=1.12.0,>=1.9->transformers[torch]) (1.11.1)\n", "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch!=1.12.0,>=1.9->transformers[torch]) (3.1)\n", "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch!=1.12.0,>=1.9->transformers[torch]) (3.1.2)\n", "Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.10/dist-packages (from torch!=1.12.0,>=1.9->transformers[torch]) (2.0.0)\n", "Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch!=1.12.0,>=1.9->transformers[torch]) (3.25.2)\n", "Requirement already satisfied: lit in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch!=1.12.0,>=1.9->transformers[torch]) (16.0.6)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (1.26.16)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (2023.5.7)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (2.0.12)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->transformers[torch]) (3.4)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch!=1.12.0,>=1.9->transformers[torch]) (2.1.3)\n", "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch!=1.12.0,>=1.9->transformers[torch]) (1.3.0)\n" ] } ] }, { "cell_type": "code", "source": [ "! pip install accelerate -U" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "wF6wgPPHXS3B", "outputId": "1758a45c-531e-4487-f838-1863560396d7" }, "execution_count": 27, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: accelerate in /usr/local/lib/python3.10/dist-packages (0.20.3)\n", "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from accelerate) (1.22.4)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from accelerate) (23.1)\n", "Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from accelerate) (5.9.5)\n", "Requirement already satisfied: pyyaml in /usr/local/lib/python3.10/dist-packages (from accelerate) (6.0)\n", "Requirement already satisfied: torch>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from accelerate) (2.0.1+cu118)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->accelerate) (3.12.2)\n", "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->accelerate) (4.6.3)\n", "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->accelerate) (1.11.1)\n", "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->accelerate) (3.1)\n", "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->accelerate) (3.1.2)\n", "Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->accelerate) (2.0.0)\n", "Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.6.0->accelerate) (3.25.2)\n", "Requirement already satisfied: lit in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.6.0->accelerate) (16.0.6)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch>=1.6.0->accelerate) (2.1.3)\n", "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch>=1.6.0->accelerate) (1.3.0)\n" ] } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "1yhRHdQJYZsD" }, "execution_count": 27, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "CczA5lJlIrJX" }, "source": [ "Note that we don't get a warning like in our classification example. This means we used all the weights of the pretrained model and there is no randomly initialized head in this case." ] }, { "cell_type": "markdown", "metadata": { "id": "_N8urzhyIrJY" }, "source": [ "To instantiate a `Seq2SeqTrainer`, we will need to define three more things. The most important is the [`Seq2SeqTrainingArguments`](https://huggingface.co/transformers/main_classes/trainer.html#transformers.Seq2SeqTrainingArguments), which is a class that contains all the attributes to customize the training. It requires one folder name, which will be used to save the checkpoints of the model, and all other arguments are optional:" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "id": "lM5S653z1wfv" }, "outputs": [], "source": [ "batch_size = 16\n", "model_name = model_checkpoint.split(\"/\")[-1]\n", "args = Seq2SeqTrainingArguments(\n", " f\"{model_name}-finetuned-xsum\",\n", " evaluation_strategy = \"epoch\",\n", " learning_rate=2e-5,\n", " per_device_train_batch_size=batch_size,\n", " per_device_eval_batch_size=batch_size,\n", " weight_decay=0.01,\n", " save_total_limit=3,\n", " num_train_epochs=1,\n", " predict_with_generate=True,\n", " fp16=True,\n", " push_to_hub=True,\n", ")" ] }, { "cell_type": "code", "source": [], "metadata": { "id": "0NEUN3P8XNAC" }, "execution_count": 28, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "km3pGVdTIrJc" }, "source": [ "Here we set the evaluation to be done at the end of each epoch, tweak the learning rate, use the `batch_size` defined at the top of the cell and customize the weight decay. Since the `Seq2SeqTrainer` will save the model regularly and our dataset is quite large, we tell it to make three saves maximum. Lastly, we use the `predict_with_generate` option (to properly generate summaries) and activate mixed precision training (to go a bit faster).\n", "\n", "The last argument to setup everything so we can push the model to the [Hub](https://huggingface.co/models) regularly during training. Remove it if you didn't follow the installation steps at the top of the notebook. If you want to save your model locally in a name that is different than the name of the repository it will be pushed, or if you want to push your model under an organization and not your name space, use the `hub_model_id` argument to set the repo name (it needs to be the full name, including your namespace: for instance `\"sgugger/t5-finetuned-xsum\"` or `\"huggingface/t5-finetuned-xsum\"`).\n", "\n", "Then, we need a special kind of data collator, which will not only pad the inputs to the maximum length in the batch, but also the labels:" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "id": "rSq6QKTr1wfv" }, "outputs": [], "source": [ "data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)" ] }, { "cell_type": "markdown", "metadata": { "id": "7sZOdRlRIrJd" }, "source": [ "The last thing to define for our `Seq2SeqTrainer` is how to compute the metrics from the predictions. We need to define a function for this, which will just use the `metric` we loaded earlier, and we have to do a bit of pre-processing to decode the predictions into texts:" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "id": "UmvbnJ9JIrJd" }, "outputs": [], "source": [ "import nltk\n", "import numpy as np\n", "\n", "def compute_metrics(eval_pred):\n", " predictions, labels = eval_pred\n", " decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)\n", " # Replace -100 in the labels as we can't decode them.\n", " labels = np.where(labels != -100, labels, tokenizer.pad_token_id)\n", " decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)\n", "\n", " # Rouge expects a newline after each sentence\n", " decoded_preds = [\"\\n\".join(nltk.sent_tokenize(pred.strip())) for pred in decoded_preds]\n", " decoded_labels = [\"\\n\".join(nltk.sent_tokenize(label.strip())) for label in decoded_labels]\n", "\n", " # Note that other metrics may not have a `use_aggregator` parameter\n", " # and thus will return a list, computing a metric for each sentence.\n", " result = metric.compute(predictions=decoded_preds, references=decoded_labels, use_stemmer=True, use_aggregator=True)\n", " # Extract a few results\n", " result = {key: value * 100 for key, value in result.items()}\n", "\n", " # Add mean generated length\n", " prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in predictions]\n", " result[\"gen_len\"] = np.mean(prediction_lens)\n", "\n", " return {k: round(v, 4) for k, v in result.items()}" ] }, { "cell_type": "code", "source": [ "from huggingface_hub import notebook_login\n", "\n", "notebook_login()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 162, "referenced_widgets": [ "b78b31766cb94d41ae743d499a73f44e", "8b62f74571274ab7b867a18aa7ab687f", "8316c86c486a48b98e436d31be5ae393", "f381accb43a146088ceb2239ec13934f", "b3ad33aaed944777a0c2991f5b7ea4d9", "fbd498271e2d42239bcf96e354e3f786", "eec41b814a8441a3ab17350eef3e895d", "b3e75516f28c4158b579bc1b66e02bac", "d81dcadb89a74d9abe701c860c294ed7", "261b976a6ec84242a911420b7bfac720", "6c2e40a42e3342bfabacfef9cfb88d18", "c430245014db45818c8529e6ff83d303", "db8a441f4c284540821a5bc75d2308ec", "e29c28796a764a0a8b18e3f637f341f8", "1027d6a0426e4d9dbb1c5b778b51b25b", "0a62e3ca9fef4a9f9689aa2fbdc51e9f", "f3376714d47c49c28e55b09741697554", "f2dcff231b7543f896baaefac5c2abe0", "5b3dac49b72e453c8f6539144eddd6c1", "f081b5b7dd3a45469e24085f901fd090", "15247f818b3a49fcb62488cadb5bea01", "3f73d0c8d0e347f5bd620983a9f66675", "e569a4fd61e84281b3cf4e8f79a6ec82", "3037acaa3b08453b8db84ab6846f98ff", "0d7daa89824444c19fe01463ed52c13d", "2b6167435bf94917864f0c78b52d5889", "403c0f83852f4fae86e8394d449054f8", "9c1173c8d30741c3a05f72a3b5a8595e", "ef57bf882b8b4585a648eb61e961a9c4", "b437a409daba41da9b52782318f33d1c", "cbff2a6c04ca479f851bcf802e9e8ec5", "f0b9f838726249bdba2fb896cae4b312" ] }, "id": "B5WoT9YlbyFb", "outputId": "728e4020-a110-4c5c-8af9-943cdd20c0bd" }, "execution_count": 53, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "VBox(children=(HTML(value='
" ], "text/html": [ "\n", "
\n", " \n", " \n", " [12753/12753 3:06:10, Epoch 1/1]\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EpochTraining LossValidation LossRouge1Rouge2RougelRougelsumGen Len
12.7102002.47833028.3171007.73780022.24920022.24890018.825500

" ] }, "metadata": {} }, { "output_type": "stream", "name": "stderr", "text": [ "Several commits (28) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (28) will be pushed upstream.\n", "Several commits (29) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (29) will be pushed upstream.\n", "Several commits (30) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (30) will be pushed upstream.\n", "Several commits (31) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (31) will be pushed upstream.\n", "Several commits (32) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (32) will be pushed upstream.\n", "Several commits (33) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (33) will be pushed upstream.\n", "Several commits (34) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (34) will be pushed upstream.\n", "Several commits (35) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (35) will be pushed upstream.\n", "Several commits (36) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (36) will be pushed upstream.\n", "Several commits (37) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (37) will be pushed upstream.\n", "Several commits (38) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (38) will be pushed upstream.\n", "Several commits (39) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (39) will be pushed upstream.\n", "Several commits (40) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (40) will be pushed upstream.\n", "Several commits (41) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (41) will be pushed upstream.\n", "Several commits (42) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (42) will be pushed upstream.\n", "Several commits (43) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (43) will be pushed upstream.\n", "Several commits (44) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (44) will be pushed upstream.\n", "Several commits (45) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (45) will be pushed upstream.\n", "Several commits (46) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (46) will be pushed upstream.\n", "Several commits (47) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (47) will be pushed upstream.\n", "Several commits (48) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (48) will be pushed upstream.\n", "Several commits (49) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (49) will be pushed upstream.\n", "Several commits (50) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (50) will be pushed upstream.\n", "Several commits (51) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (51) will be pushed upstream.\n", "Several commits (52) will be pushed upstream.\n", "WARNING:huggingface_hub.repository:Several commits (52) will be pushed upstream.\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/html": [ "\n", "

\n", " \n", " \n", " [12753/12753 2:58:49, Epoch 1/1]\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EpochTraining LossValidation Loss

\n", "

\n", " \n", " \n", " [709/709 3:29:31]\n", "
\n", " " ] }, "metadata": {} }, { "output_type": "execute_result", "data": { "text/plain": [ "TrainOutput(global_step=12753, training_loss=2.7092539816382053, metrics={'train_runtime': 11171.298, 'train_samples_per_second': 18.265, 'train_steps_per_second': 1.142, 'total_flos': 5.511633300671693e+16, 'train_loss': 2.7092539816382053, 'epoch': 1.0})" ] }, "metadata": {}, "execution_count": 40 } ], "source": [ "trainer.train()" ] }, { "cell_type": "code", "source": [ "import nltk\n", "nltk.download('punkt')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "qos4YXnjHBZJ", "outputId": "766c5254-6046-4af2-9c8d-53ce3d49867d" }, "execution_count": 35, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "[nltk_data] Downloading package punkt to /root/nltk_data...\n", "[nltk_data] Unzipping tokenizers/punkt.zip.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "True" ] }, "metadata": {}, "execution_count": 35 } ] }, { "cell_type": "markdown", "metadata": { "id": "7WdpbAD-1wfx" }, "source": [ "You can now upload the result of the training to the Hub, just execute this instruction:" ] }, { "cell_type": "code", "execution_count": 65, "metadata": { "id": "5xkstOrQ1wfx" }, "outputs": [], "source": [ "trainer.push_to_hub(\"JeffGuo/my_model\")" ] }, { "cell_type": "code", "source": [ "trainer" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "BMHNZPSuHASf", "outputId": "5952ecdb-7e93-4272-87b4-90fda518bd33" }, "execution_count": 55, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 55 } ] }, { "cell_type": "markdown", "metadata": { "id": "MhoSaO7S1wfx" }, "source": [ "You can now share this model with all your friends, family, favorite pets: they can all load it with the identifier `\"your-username/the-name-you-picked\"` so for instance:\n", "\n", "```python\n", "from transformers import AutoModelForSeq2SeqLM\n", "\n", "model = AutoModelForSeq2SeqLM.from_pretrained(\"sgugger/my-awesome-model\")\n", "```" ] }, { "cell_type": "code", "execution_count": 57, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "wAiixvdT1wfy", "outputId": "02c167b8-dd9a-4ee2-af33-3d2c59ce14e0" }, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/\u001b[0m\u001b[1;33m_errors.py\u001b[0m:\u001b[94m261\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mhf_raise_for_status\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m258 \u001b[0m\u001b[2;33m│ \u001b[0m\u001b[33m\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m259 \u001b[0m\u001b[2;33m│ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m260 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m261 \u001b[2m│ │ \u001b[0mresponse.raise_for_status() \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m262 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mexcept\u001b[0m HTTPError \u001b[94mas\u001b[0m e: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m263 \u001b[0m\u001b[2m│ │ \u001b[0merror_code = response.headers.get(\u001b[33m\"\u001b[0m\u001b[33mX-Error-Code\u001b[0m\u001b[33m\"\u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m264 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/requests/\u001b[0m\u001b[1;33mmodels.py\u001b[0m:\u001b[94m960\u001b[0m in \u001b[92mraise_for_status\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m957 \u001b[0m\u001b[2m│ │ │ \u001b[0mhttp_error_msg = \u001b[33mu\u001b[0m\u001b[33m'\u001b[0m\u001b[33m%s\u001b[0m\u001b[33m Server Error: \u001b[0m\u001b[33m%s\u001b[0m\u001b[33m for url: \u001b[0m\u001b[33m%s\u001b[0m\u001b[33m'\u001b[0m % (\u001b[96mself\u001b[0m.status_code, rea \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m958 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m959 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m http_error_msg: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m960 \u001b[2m│ │ │ \u001b[0m\u001b[94mraise\u001b[0m HTTPError(http_error_msg, response=\u001b[96mself\u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m961 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m962 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mclose\u001b[0m(\u001b[96mself\u001b[0m): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m963 \u001b[0m\u001b[2;90m│ │ \u001b[0m\u001b[33m\"\"\"Releases the connection back to the pool. Once this method has been\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mHTTPError: \u001b[0m\u001b[1;36m404\u001b[0m Client Error: Not Found for url: \u001b[4;94mhttps://huggingface.co/JeffGuo/my_model/resolve/main/config.json\u001b[0m\n", "\n", "\u001b[3mThe above exception was the direct cause of the following exception:\u001b[0m\n", "\n", "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/transformers/utils/\u001b[0m\u001b[1;33mhub.py\u001b[0m:\u001b[94m417\u001b[0m in \u001b[92mcached_file\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 414 \u001b[0m\u001b[2m│ \u001b[0muser_agent = http_user_agent(user_agent) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 415 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 416 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# Load from URL or cache if already cached\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 417 \u001b[2m│ │ \u001b[0mresolved_file = hf_hub_download( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 418 \u001b[0m\u001b[2m│ │ │ \u001b[0mpath_or_repo_id, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 419 \u001b[0m\u001b[2m│ │ │ \u001b[0mfilename, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 420 \u001b[0m\u001b[2m│ │ │ \u001b[0msubfolder=\u001b[94mNone\u001b[0m \u001b[94mif\u001b[0m \u001b[96mlen\u001b[0m(subfolder) == \u001b[94m0\u001b[0m \u001b[94melse\u001b[0m subfolder, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/\u001b[0m\u001b[1;33m_validators.py\u001b[0m:\u001b[94m118\u001b[0m in \u001b[92m_inner_fn\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m115 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m check_use_auth_token: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m116 \u001b[0m\u001b[2m│ │ │ \u001b[0mkwargs = smoothly_deprecate_use_auth_token(fn_name=fn.\u001b[91m__name__\u001b[0m, has_token=ha \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m117 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m118 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m fn(*args, **kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m119 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m120 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mreturn\u001b[0m _inner_fn \u001b[2m# type: ignore\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m121 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/huggingface_hub/\u001b[0m\u001b[1;33mfile_download.py\u001b[0m:\u001b[94m1195\u001b[0m in \u001b[92mhf_hub_download\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1192 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mif\u001b[0m \u001b[95mnot\u001b[0m local_files_only: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1193 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1194 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m1195 \u001b[2m│ │ │ │ \u001b[0mmetadata = get_hf_file_metadata( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1196 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0murl=url, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1197 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0mtoken=token, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1198 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0mproxies=proxies, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/\u001b[0m\u001b[1;33m_validators.py\u001b[0m:\u001b[94m118\u001b[0m in \u001b[92m_inner_fn\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m115 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m check_use_auth_token: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m116 \u001b[0m\u001b[2m│ │ │ \u001b[0mkwargs = smoothly_deprecate_use_auth_token(fn_name=fn.\u001b[91m__name__\u001b[0m, has_token=ha \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m117 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m118 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m fn(*args, **kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m119 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m120 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mreturn\u001b[0m _inner_fn \u001b[2m# type: ignore\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m121 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/huggingface_hub/\u001b[0m\u001b[1;33mfile_download.py\u001b[0m:\u001b[94m1541\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mget_hf_file_metadata\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1538 \u001b[0m\u001b[2m│ │ \u001b[0mproxies=proxies, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1539 \u001b[0m\u001b[2m│ │ \u001b[0mtimeout=timeout, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1540 \u001b[0m\u001b[2m│ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m1541 \u001b[2m│ \u001b[0mhf_raise_for_status(r) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1542 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1543 \u001b[0m\u001b[2m│ \u001b[0m\u001b[2m# Return\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1544 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mreturn\u001b[0m HfFileMetadata( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/\u001b[0m\u001b[1;33m_errors.py\u001b[0m:\u001b[94m293\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mhf_raise_for_status\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m290 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[33m\"\u001b[0m\u001b[33m `repo_type`.\u001b[0m\u001b[33m\\n\u001b[0m\u001b[33mIf you are trying to access a private or gated repo,\u001b[0m\u001b[33m\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m291 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[33m\"\u001b[0m\u001b[33m make sure you are authenticated.\u001b[0m\u001b[33m\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m292 \u001b[0m\u001b[2m│ │ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m293 \u001b[2m│ │ │ \u001b[0m\u001b[94mraise\u001b[0m RepositoryNotFoundError(message, response) \u001b[94mfrom\u001b[0m \u001b[4;96me\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m294 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m295 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94melif\u001b[0m response.status_code == \u001b[94m400\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m296 \u001b[0m\u001b[2m│ │ │ \u001b[0mmessage = ( \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mRepositoryNotFoundError: \u001b[0m\u001b[1;36m404\u001b[0m Client Error. \u001b[1m(\u001b[0mRequest ID: \n", "\u001b[33mRoot\u001b[0m=\u001b[1;36m1\u001b[0m-64a83bdb-77e81da43b5d28ea6d550569;\u001b[93mefcc0ac0-0ddb-49f0-9746-8fc12c5b5565\u001b[0m\u001b[1m)\u001b[0m\n", "\n", "Repository Not Found for url: \u001b[4;94mhttps://huggingface.co/JeffGuo/my_model/resolve/main/config.json.\u001b[0m\n", "Please make sure you specified the correct `repo_id` and `repo_type`.\n", "If you are trying to access a private or gated repo, make sure you are authenticated.\n", "\n", "\u001b[3mDuring handling of the above exception, another exception occurred:\u001b[0m\n", "\n", "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m in \u001b[92m\u001b[0m:\u001b[94m3\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/transformers/models/auto/\u001b[0m\u001b[1;33mauto_factory.py\u001b[0m:\u001b[94m456\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mfrom_pretrained\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m453 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mif\u001b[0m kwargs.get(\u001b[33m\"\u001b[0m\u001b[33mtorch_dtype\u001b[0m\u001b[33m\"\u001b[0m, \u001b[94mNone\u001b[0m) == \u001b[33m\"\u001b[0m\u001b[33mauto\u001b[0m\u001b[33m\"\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m454 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m_ = kwargs.pop(\u001b[33m\"\u001b[0m\u001b[33mtorch_dtype\u001b[0m\u001b[33m\"\u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m455 \u001b[0m\u001b[2m│ │ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m456 \u001b[2m│ │ │ \u001b[0mconfig, kwargs = AutoConfig.from_pretrained( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m457 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mpretrained_model_name_or_path, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m458 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mreturn_unused_kwargs=\u001b[94mTrue\u001b[0m, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m459 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mtrust_remote_code=trust_remote_code, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/transformers/models/auto/\u001b[0m\u001b[1;33mconfiguration_auto.py\u001b[0m:\u001b[94m944\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mfrom_pretrained\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m941 \u001b[0m\u001b[2m│ │ \u001b[0mkwargs[\u001b[33m\"\u001b[0m\u001b[33m_from_auto\u001b[0m\u001b[33m\"\u001b[0m] = \u001b[94mTrue\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m942 \u001b[0m\u001b[2m│ │ \u001b[0mkwargs[\u001b[33m\"\u001b[0m\u001b[33mname_or_path\u001b[0m\u001b[33m\"\u001b[0m] = pretrained_model_name_or_path \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m943 \u001b[0m\u001b[2m│ │ \u001b[0mtrust_remote_code = kwargs.pop(\u001b[33m\"\u001b[0m\u001b[33mtrust_remote_code\u001b[0m\u001b[33m\"\u001b[0m, \u001b[94mNone\u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m944 \u001b[2m│ │ \u001b[0mconfig_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_n \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m945 \u001b[0m\u001b[2m│ │ \u001b[0mhas_remote_code = \u001b[33m\"\u001b[0m\u001b[33mauto_map\u001b[0m\u001b[33m\"\u001b[0m \u001b[95min\u001b[0m config_dict \u001b[95mand\u001b[0m \u001b[33m\"\u001b[0m\u001b[33mAutoConfig\u001b[0m\u001b[33m\"\u001b[0m \u001b[95min\u001b[0m config_dict[\u001b[33m\"\u001b[0m\u001b[33maut\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m946 \u001b[0m\u001b[2m│ │ \u001b[0mhas_local_code = \u001b[33m\"\u001b[0m\u001b[33mmodel_type\u001b[0m\u001b[33m\"\u001b[0m \u001b[95min\u001b[0m config_dict \u001b[95mand\u001b[0m config_dict[\u001b[33m\"\u001b[0m\u001b[33mmodel_type\u001b[0m\u001b[33m\"\u001b[0m] \u001b[95min\u001b[0m CO \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m947 \u001b[0m\u001b[2m│ │ \u001b[0mtrust_remote_code = resolve_trust_remote_code( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/transformers/\u001b[0m\u001b[1;33mconfiguration_utils.py\u001b[0m:\u001b[94m574\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mget_config_dict\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m571 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m572 \u001b[0m\u001b[2m│ │ \u001b[0moriginal_kwargs = copy.deepcopy(kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m573 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# Get config dict associated with the base config file\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m574 \u001b[2m│ │ \u001b[0mconfig_dict, kwargs = \u001b[96mcls\u001b[0m._get_config_dict(pretrained_model_name_or_path, **kwar \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m575 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[33m\"\u001b[0m\u001b[33m_commit_hash\u001b[0m\u001b[33m\"\u001b[0m \u001b[95min\u001b[0m config_dict: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m576 \u001b[0m\u001b[2m│ │ │ \u001b[0moriginal_kwargs[\u001b[33m\"\u001b[0m\u001b[33m_commit_hash\u001b[0m\u001b[33m\"\u001b[0m] = config_dict[\u001b[33m\"\u001b[0m\u001b[33m_commit_hash\u001b[0m\u001b[33m\"\u001b[0m] \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m577 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/transformers/\u001b[0m\u001b[1;33mconfiguration_utils.py\u001b[0m:\u001b[94m629\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92m_get_config_dict\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m626 \u001b[0m\u001b[2m│ │ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m627 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m628 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# Load from local folder or from cache or download from model Hub and ca\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m629 \u001b[2m│ │ │ │ \u001b[0mresolved_config_file = cached_file( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m630 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0mpretrained_model_name_or_path, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m631 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0mconfiguration_file, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m632 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0mcache_dir=cache_dir, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/usr/local/lib/python3.10/dist-packages/transformers/utils/\u001b[0m\u001b[1;33mhub.py\u001b[0m:\u001b[94m433\u001b[0m in \u001b[92mcached_file\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 430 \u001b[0m\u001b[2m│ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 431 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 432 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mexcept\u001b[0m RepositoryNotFoundError: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 433 \u001b[2m│ │ \u001b[0m\u001b[94mraise\u001b[0m \u001b[96mEnvironmentError\u001b[0m( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 434 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[33mf\u001b[0m\u001b[33m\"\u001b[0m\u001b[33m{\u001b[0mpath_or_repo_id\u001b[33m}\u001b[0m\u001b[33m is not a local folder and is not a valid model identifie\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 435 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[33m\"\u001b[0m\u001b[33mlisted on \u001b[0m\u001b[33m'\u001b[0m\u001b[33mhttps://huggingface.co/models\u001b[0m\u001b[33m'\u001b[0m\u001b[33m\\n\u001b[0m\u001b[33mIf this is a private repository,\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 436 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[33m\"\u001b[0m\u001b[33mpass a token having permission to this repo with `use_auth_token` or log in\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mOSError: \u001b[0mJeffGuo/my_model is not a local folder and is not a valid model identifier listed on \n", "\u001b[32m'https://huggingface.co/models'\u001b[0m\n", "If this is a private repository, make sure to pass a token having permission to this repo with `use_auth_token` or \n", "log in with `huggingface-cli login` and pass `\u001b[33muse_auth_token\u001b[0m=\u001b[3;92mTrue\u001b[0m`.\n" ], "text/html": [ "
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
              "│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_errors.py:261 in                  │\n",
              "│ hf_raise_for_status                                                                              │\n",
              "│                                                                                                  │\n",
              "│   258 │   </Tip>                                                                                 │\n",
              "│   259 │   \"\"\"                                                                                    │\n",
              "│   260 │   try:                                                                                   │\n",
              "│ ❱ 261 │   │   response.raise_for_status()                                                        │\n",
              "│   262 │   except HTTPError as e:                                                                 │\n",
              "│   263 │   │   error_code = response.headers.get(\"X-Error-Code\")                                  │\n",
              "│   264                                                                                            │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/requests/models.py:960 in raise_for_status               │\n",
              "│                                                                                                  │\n",
              "│   957 │   │   │   http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, rea   │\n",
              "│   958 │   │                                                                                      │\n",
              "│   959 │   │   if http_error_msg:                                                                 │\n",
              "│ ❱ 960 │   │   │   raise HTTPError(http_error_msg, response=self)                                 │\n",
              "│   961 │                                                                                          │\n",
              "│   962 │   def close(self):                                                                       │\n",
              "│   963 │   │   \"\"\"Releases the connection back to the pool. Once this method has been             │\n",
              "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
              "HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/JeffGuo/my_model/resolve/main/config.json\n",
              "\n",
              "The above exception was the direct cause of the following exception:\n",
              "\n",
              "╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
              "│ /usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py:417 in cached_file             │\n",
              "│                                                                                                  │\n",
              "│    414 │   user_agent = http_user_agent(user_agent)                                              │\n",
              "│    415 │   try:                                                                                  │\n",
              "│    416 │   │   # Load from URL or cache if already cached                                        │\n",
              "│ ❱  417 │   │   resolved_file = hf_hub_download(                                                  │\n",
              "│    418 │   │   │   path_or_repo_id,                                                              │\n",
              "│    419 │   │   │   filename,                                                                     │\n",
              "│    420 │   │   │   subfolder=None if len(subfolder) == 0 else subfolder,                         │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py:118 in _inner_fn    │\n",
              "│                                                                                                  │\n",
              "│   115 │   │   if check_use_auth_token:                                                           │\n",
              "│   116 │   │   │   kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=ha   │\n",
              "│   117 │   │                                                                                      │\n",
              "│ ❱ 118 │   │   return fn(*args, **kwargs)                                                         │\n",
              "│   119 │                                                                                          │\n",
              "│   120 │   return _inner_fn  # type: ignore                                                       │\n",
              "│   121                                                                                            │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:1195 in hf_hub_download │\n",
              "│                                                                                                  │\n",
              "│   1192 │   if not local_files_only:                                                              │\n",
              "│   1193 │   │   try:                                                                              │\n",
              "│   1194 │   │   │   try:                                                                          │\n",
              "│ ❱ 1195 │   │   │   │   metadata = get_hf_file_metadata(                                          │\n",
              "│   1196 │   │   │   │   │   url=url,                                                              │\n",
              "│   1197 │   │   │   │   │   token=token,                                                          │\n",
              "│   1198 │   │   │   │   │   proxies=proxies,                                                      │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py:118 in _inner_fn    │\n",
              "│                                                                                                  │\n",
              "│   115 │   │   if check_use_auth_token:                                                           │\n",
              "│   116 │   │   │   kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=ha   │\n",
              "│   117 │   │                                                                                      │\n",
              "│ ❱ 118 │   │   return fn(*args, **kwargs)                                                         │\n",
              "│   119 │                                                                                          │\n",
              "│   120 │   return _inner_fn  # type: ignore                                                       │\n",
              "│   121                                                                                            │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:1541 in                 │\n",
              "│ get_hf_file_metadata                                                                             │\n",
              "│                                                                                                  │\n",
              "│   1538 │   │   proxies=proxies,                                                                  │\n",
              "│   1539 │   │   timeout=timeout,                                                                  │\n",
              "│   1540 │   )                                                                                     │\n",
              "│ ❱ 1541 │   hf_raise_for_status(r)                                                                │\n",
              "│   1542 │                                                                                         │\n",
              "│   1543 │   # Return                                                                              │\n",
              "│   1544 │   return HfFileMetadata(                                                                │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_errors.py:293 in                  │\n",
              "│ hf_raise_for_status                                                                              │\n",
              "│                                                                                                  │\n",
              "│   290 │   │   │   │   \" `repo_type`.\\nIf you are trying to access a private or gated repo,\"      │\n",
              "│   291 │   │   │   │   \" make sure you are authenticated.\"                                        │\n",
              "│   292 │   │   │   )                                                                              │\n",
              "│ ❱ 293 │   │   │   raise RepositoryNotFoundError(message, response) from e                        │\n",
              "│   294 │   │                                                                                      │\n",
              "│   295 │   │   elif response.status_code == 400:                                                  │\n",
              "│   296 │   │   │   message = (                                                                    │\n",
              "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
              "RepositoryNotFoundError: 404 Client Error. (Request ID: \n",
              "Root=1-64a83bdb-77e81da43b5d28ea6d550569;efcc0ac0-0ddb-49f0-9746-8fc12c5b5565)\n",
              "\n",
              "Repository Not Found for url: https://huggingface.co/JeffGuo/my_model/resolve/main/config.json.\n",
              "Please make sure you specified the correct `repo_id` and `repo_type`.\n",
              "If you are trying to access a private or gated repo, make sure you are authenticated.\n",
              "\n",
              "During handling of the above exception, another exception occurred:\n",
              "\n",
              "╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
              "│ in <cell line: 3>:3                                                                              │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/transformers/models/auto/auto_factory.py:456 in          │\n",
              "│ from_pretrained                                                                                  │\n",
              "│                                                                                                  │\n",
              "│   453 │   │   │   if kwargs.get(\"torch_dtype\", None) == \"auto\":                                  │\n",
              "│   454 │   │   │   │   _ = kwargs.pop(\"torch_dtype\")                                              │\n",
              "│   455 │   │   │                                                                                  │\n",
              "│ ❱ 456 │   │   │   config, kwargs = AutoConfig.from_pretrained(                                   │\n",
              "│   457 │   │   │   │   pretrained_model_name_or_path,                                             │\n",
              "│   458 │   │   │   │   return_unused_kwargs=True,                                                 │\n",
              "│   459 │   │   │   │   trust_remote_code=trust_remote_code,                                       │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/transformers/models/auto/configuration_auto.py:944 in    │\n",
              "│ from_pretrained                                                                                  │\n",
              "│                                                                                                  │\n",
              "│   941 │   │   kwargs[\"_from_auto\"] = True                                                        │\n",
              "│   942 │   │   kwargs[\"name_or_path\"] = pretrained_model_name_or_path                             │\n",
              "│   943 │   │   trust_remote_code = kwargs.pop(\"trust_remote_code\", None)                          │\n",
              "│ ❱ 944 │   │   config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_n   │\n",
              "│   945 │   │   has_remote_code = \"auto_map\" in config_dict and \"AutoConfig\" in config_dict[\"aut   │\n",
              "│   946 │   │   has_local_code = \"model_type\" in config_dict and config_dict[\"model_type\"] in CO   │\n",
              "│   947 │   │   trust_remote_code = resolve_trust_remote_code(                                     │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/transformers/configuration_utils.py:574 in               │\n",
              "│ get_config_dict                                                                                  │\n",
              "│                                                                                                  │\n",
              "│   571 │   │   \"\"\"                                                                                │\n",
              "│   572 │   │   original_kwargs = copy.deepcopy(kwargs)                                            │\n",
              "│   573 │   │   # Get config dict associated with the base config file                             │\n",
              "│ ❱ 574 │   │   config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwar   │\n",
              "│   575 │   │   if \"_commit_hash\" in config_dict:                                                  │\n",
              "│   576 │   │   │   original_kwargs[\"_commit_hash\"] = config_dict[\"_commit_hash\"]                  │\n",
              "│   577                                                                                            │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/transformers/configuration_utils.py:629 in               │\n",
              "│ _get_config_dict                                                                                 │\n",
              "│                                                                                                  │\n",
              "│   626 │   │   │                                                                                  │\n",
              "│   627 │   │   │   try:                                                                           │\n",
              "│   628 │   │   │   │   # Load from local folder or from cache or download from model Hub and ca   │\n",
              "│ ❱ 629 │   │   │   │   resolved_config_file = cached_file(                                        │\n",
              "│   630 │   │   │   │   │   pretrained_model_name_or_path,                                         │\n",
              "│   631 │   │   │   │   │   configuration_file,                                                    │\n",
              "│   632 │   │   │   │   │   cache_dir=cache_dir,                                                   │\n",
              "│                                                                                                  │\n",
              "│ /usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py:433 in cached_file             │\n",
              "│                                                                                                  │\n",
              "│    430 │   │   )                                                                                 │\n",
              "│    431 │                                                                                         │\n",
              "│    432 │   except RepositoryNotFoundError:                                                       │\n",
              "│ ❱  433 │   │   raise EnvironmentError(                                                           │\n",
              "│    434 │   │   │   f\"{path_or_repo_id} is not a local folder and is not a valid model identifie  │\n",
              "│    435 │   │   │   \"listed on 'https://huggingface.co/models'\\nIf this is a private repository,  │\n",
              "│    436 │   │   │   \"pass a token having permission to this repo with `use_auth_token` or log in  │\n",
              "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
              "OSError: JeffGuo/my_model is not a local folder and is not a valid model identifier listed on \n",
              "'https://huggingface.co/models'\n",
              "If this is a private repository, make sure to pass a token having permission to this repo with `use_auth_token` or \n",
              "log in with `huggingface-cli login` and pass `use_auth_token=True`.\n",
              "
\n" ] }, "metadata": {} } ], "source": [ "from transformers import AutoModelForSeq2SeqLM\n", "\n", "model = AutoModelForSeq2SeqLM.from_pretrained(\"JeffGuo/my_model\")" ] }, { "cell_type": "code", "source": [ "from transformers import AutoModelForSeq2SeqLM\n", "model = AutoModelForSeq2SeqLM.from_pretrained(\"/content/t5-small-finetuned-xsum/checkpoint-12500\")" ], "metadata": { "id": "0PQsyHmw_M3Y" }, "execution_count": 64, "outputs": [] }, { "cell_type": "code", "source": [ "from transformers import pipeline\n", "from random import randrange\n", "\n", "# load model and tokenizer from huggingface hub with pipeline\n", "summarizer = pipeline(\"summarization\", model=\"/content/t5-small-finetuned-xsum/checkpoint-12500\", device=0)\n", "\n", "# select a random test sample\n", "sample = raw_datasets['test'][randrange(len(raw_datasets[\"test\"]))]\n", "print(f\"document: \\n{sample['document']}\\n---------------\")\n", "\n", "# summarize dialogue\n", "#summarizer(\"A household name in China, the Hong-Kong born American singer was remembered for her electrifying energy and megawatt smile on stage and in front of the public. And many people were in disbelief after the news broke late at night on Wednesday. Hashtags such as \"how close depression is near you\", \"symptoms of depression\" have been trending on different online platforms, state media outlets like CCTV, People's Daily and China Daily have put out content to raise people's awareness of depression and mental illness.\")\n", "print(type(sample[\"document\"]))\n", "res = summarizer(sample[\"document\"])\n", "\n", "\n", "print(f\"flan-t5-base summary:\\n{res[0]['summary_text']}\")\n", "\n", "#summarizer([\"\"])" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "_JeFYSQ7L2Ck", "outputId": "bf90d9d0-0145-4e50-acf1-3984d92e67f7" }, "execution_count": 83, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "document: \n", "Second-year scholars Callum Pritchard-Ellis, James Ballie, Callum Saunders, James Jones, Fraser Murdock and Perry Ng have all been offered senior deals.\n", "Davis told BBC Radio Stoke: \"We're delighted to have another strong group.\n", "\"Producing our own younger players is going to be more important. It only bodes well for the future of the club.\"\n", "Additionally, three under-16s have also signed first-year scholar contracts.\n", "Crewe's under-21s have enjoyed success again this season, reaching the Professional Development League Two final thanks to a 4-0 win against Cardiff on Wednesday.\n", "Crewe will now play Queens Park Rangers in the final at Loftus Road.\n", "\"The secondary scholars have all been fairly strong,\" Davis added. \"It took a lot of meetings to decide which of the players we would take.\n", "\"The future, at the moment, looks very healthy.\n", "\"It's harder to recruit players now, because of the demands of some of the players and the agents.\n", "\"Experienced players are more or less a 'no, no' for us, particularly names that people know. Financially, they're always out of our domain. Our own players can give us a better style of playing.\"\n", "---------------\n", "\n", "flan-t5-base summary:\n", "Crewe's senior scholars have been offered senior contracts for the club's first-year scholar. - A senior scholar has said the future of the club will be \"healthy\".\n" ] } ] } ], "metadata": { "colab": { "name": "Summarization", "provenance": [], "gpuType": "T4" }, "kernelspec": { "display_name": "Python 3", "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", "version": "3.11.3" }, "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { "9c59ace7d7414de39bd9089106d40b61": { "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_67cc4396a3294d8382dc50cff50fe4b2", "IPY_MODEL_ccca9f0e47ae42ee9a66de68f4776374", "IPY_MODEL_e0a18363d20448b899b205fc7cca40cb", "IPY_MODEL_801da6de33c94c42a8abf3d43472be87" ], "layout": "IPY_MODEL_56d6e462c2d646f2b105f097516042a9" } }, "b6c0102a743a4dc6a8f0d31a8782fc3a": { "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_35dd514732cf40a3ac05f7318eba5554", "placeholder": "​", "style": "IPY_MODEL_32244a1998c743ae8247816d43898b03", "value": "

Copy a token from your Hugging Face\ntokens page and paste it below.
Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file.
" } }, "5a5362b4027f47519979c90f378ed3f8": { "model_module": "@jupyter-widgets/controls", "model_name": "PasswordModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "PasswordModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "PasswordView", "continuous_update": true, "description": "Token:", "description_tooltip": null, "disabled": false, "layout": "IPY_MODEL_04cdfd25912b4019ab62fe2dcad9daa0", "placeholder": "​", "style": "IPY_MODEL_e2600a5469ed421ca2c55ad4f2df45c5", "value": "" } }, "8662568bfce34d2daa3667930e9149bb": { "model_module": "@jupyter-widgets/controls", "model_name": "CheckboxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "CheckboxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "CheckboxView", "description": "Add token as git credential?", "description_tooltip": null, "disabled": false, "indent": true, "layout": "IPY_MODEL_aa30bb4feb3c48f59730e9860efec395", "style": "IPY_MODEL_21d7542ea2eb4b7c9d2a3cc44c61db08", "value": true } }, "5fd77d6f9da048bb89ff4404a432bc8d": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ButtonView", "button_style": "", "description": "Login", "disabled": false, "icon": "", "layout": "IPY_MODEL_6f9d30b9189b4e5ea5afce58a82975b2", "style": "IPY_MODEL_32fdad1696134a67a1166db3c24b3afc", "tooltip": "" } }, "bf4cb6dd78bc49739a154bd5eace0845": { "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_70cb135100be4181a347ec64cc8d4964", "placeholder": "​", "style": "IPY_MODEL_5a80a61eea6343eabb6d895afaf4184a", "value": "\nPro Tip: If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks.
" } }, "56d6e462c2d646f2b105f097516042a9": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": "center", "align_self": null, "border": null, "bottom": null, "display": "flex", "flex": null, "flex_flow": "column", "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "50%" } }, "35dd514732cf40a3ac05f7318eba5554": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "32244a1998c743ae8247816d43898b03": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "04cdfd25912b4019ab62fe2dcad9daa0": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "e2600a5469ed421ca2c55ad4f2df45c5": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "aa30bb4feb3c48f59730e9860efec395": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "21d7542ea2eb4b7c9d2a3cc44c61db08": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "6f9d30b9189b4e5ea5afce58a82975b2": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "32fdad1696134a67a1166db3c24b3afc": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "button_color": null, "font_weight": "" } }, "70cb135100be4181a347ec64cc8d4964": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "5a80a61eea6343eabb6d895afaf4184a": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "23c71a29a5644ce39f503f440c950c4d": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_46e519b3a1dd41fa84a8195985040c52", "placeholder": "​", "style": "IPY_MODEL_c412910f38f34e50b9c8d8853b516864", "value": "Connecting..." } }, "46e519b3a1dd41fa84a8195985040c52": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c412910f38f34e50b9c8d8853b516864": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "67cc4396a3294d8382dc50cff50fe4b2": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_222bfc5456184d9ebf59c6e223c16b9b", "placeholder": "​", "style": "IPY_MODEL_c22465dd6ad54749bf20dd2f2d9ae325", "value": "Token is valid (permission: read)." } }, "ccca9f0e47ae42ee9a66de68f4776374": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_4cf75ce535f74ff39ec7e6d5fb92dbef", "placeholder": "​", "style": "IPY_MODEL_9ce113695cc34621b95c97df5276a3d7", "value": "Your token has been saved in your configured git credential helpers (store)." } }, "e0a18363d20448b899b205fc7cca40cb": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_bc70c29aca694266b90c71415e8cd086", "placeholder": "​", "style": "IPY_MODEL_3b66ed358dca41149c1679d5ddabe9d2", "value": "Your token has been saved to /root/.cache/huggingface/token" } }, "801da6de33c94c42a8abf3d43472be87": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_a7a1bf64fb7347f2b997abff3068d0aa", "placeholder": "​", "style": "IPY_MODEL_fc0f6ef8302d4d91bc1e240ba1ead27e", "value": "Login successful" } }, "222bfc5456184d9ebf59c6e223c16b9b": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c22465dd6ad54749bf20dd2f2d9ae325": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "4cf75ce535f74ff39ec7e6d5fb92dbef": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9ce113695cc34621b95c97df5276a3d7": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "bc70c29aca694266b90c71415e8cd086": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "3b66ed358dca41149c1679d5ddabe9d2": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "a7a1bf64fb7347f2b997abff3068d0aa": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "fc0f6ef8302d4d91bc1e240ba1ead27e": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "a5a5d838de2d4943b277bb2f0e739bf0": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_37337c451874401db25fb882c1ae9dfa", "IPY_MODEL_9871729cde1942808cd8724400282c0b", "IPY_MODEL_3706f03cef3e4c7b83abd17301a9a95e" ], "layout": "IPY_MODEL_e4856bc29e104eb1b352deca30cc6ad0" } }, "37337c451874401db25fb882c1ae9dfa": { "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_d1f70639afb14aa68289e202622bcb07", "placeholder": "​", "style": "IPY_MODEL_c3feac419c3442408fb0ed2410616fe8", "value": "100%" } }, "9871729cde1942808cd8724400282c0b": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_99cea22d6755472faed2975832b19907", "max": 3, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_77906a41d8ce4d91b9cc52f0b91310de", "value": 3 } }, "3706f03cef3e4c7b83abd17301a9a95e": { "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_8a08f78829c5488ead2a1dcfd75b5765", "placeholder": "​", "style": "IPY_MODEL_1fd2fccec79645e2b0a50cae106f0e7c", "value": " 3/3 [00:00<00:00, 92.61it/s]" } }, "e4856bc29e104eb1b352deca30cc6ad0": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "d1f70639afb14aa68289e202622bcb07": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c3feac419c3442408fb0ed2410616fe8": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "99cea22d6755472faed2975832b19907": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "77906a41d8ce4d91b9cc52f0b91310de": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "8a08f78829c5488ead2a1dcfd75b5765": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "1fd2fccec79645e2b0a50cae106f0e7c": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "b78b31766cb94d41ae743d499a73f44e": { "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_15247f818b3a49fcb62488cadb5bea01", "IPY_MODEL_3f73d0c8d0e347f5bd620983a9f66675", "IPY_MODEL_e569a4fd61e84281b3cf4e8f79a6ec82", "IPY_MODEL_3037acaa3b08453b8db84ab6846f98ff" ], "layout": "IPY_MODEL_eec41b814a8441a3ab17350eef3e895d" } }, "8b62f74571274ab7b867a18aa7ab687f": { "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_b3e75516f28c4158b579bc1b66e02bac", "placeholder": "​", "style": "IPY_MODEL_d81dcadb89a74d9abe701c860c294ed7", "value": "

Copy a token from your Hugging Face\ntokens page and paste it below.
Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file.
" } }, "8316c86c486a48b98e436d31be5ae393": { "model_module": "@jupyter-widgets/controls", "model_name": "PasswordModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "PasswordModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "PasswordView", "continuous_update": true, "description": "Token:", "description_tooltip": null, "disabled": false, "layout": "IPY_MODEL_261b976a6ec84242a911420b7bfac720", "placeholder": "​", "style": "IPY_MODEL_6c2e40a42e3342bfabacfef9cfb88d18", "value": "" } }, "f381accb43a146088ceb2239ec13934f": { "model_module": "@jupyter-widgets/controls", "model_name": "CheckboxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "CheckboxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "CheckboxView", "description": "Add token as git credential?", "description_tooltip": null, "disabled": false, "indent": true, "layout": "IPY_MODEL_c430245014db45818c8529e6ff83d303", "style": "IPY_MODEL_db8a441f4c284540821a5bc75d2308ec", "value": true } }, "b3ad33aaed944777a0c2991f5b7ea4d9": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ButtonView", "button_style": "", "description": "Login", "disabled": false, "icon": "", "layout": "IPY_MODEL_e29c28796a764a0a8b18e3f637f341f8", "style": "IPY_MODEL_1027d6a0426e4d9dbb1c5b778b51b25b", "tooltip": "" } }, "fbd498271e2d42239bcf96e354e3f786": { "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_0a62e3ca9fef4a9f9689aa2fbdc51e9f", "placeholder": "​", "style": "IPY_MODEL_f3376714d47c49c28e55b09741697554", "value": "\nPro Tip: If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks.
" } }, "eec41b814a8441a3ab17350eef3e895d": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": "center", "align_self": null, "border": null, "bottom": null, "display": "flex", "flex": null, "flex_flow": "column", "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "50%" } }, "b3e75516f28c4158b579bc1b66e02bac": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "d81dcadb89a74d9abe701c860c294ed7": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "261b976a6ec84242a911420b7bfac720": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "6c2e40a42e3342bfabacfef9cfb88d18": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "c430245014db45818c8529e6ff83d303": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "db8a441f4c284540821a5bc75d2308ec": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "e29c28796a764a0a8b18e3f637f341f8": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "1027d6a0426e4d9dbb1c5b778b51b25b": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "button_color": null, "font_weight": "" } }, "0a62e3ca9fef4a9f9689aa2fbdc51e9f": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f3376714d47c49c28e55b09741697554": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "f2dcff231b7543f896baaefac5c2abe0": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_5b3dac49b72e453c8f6539144eddd6c1", "placeholder": "​", "style": "IPY_MODEL_f081b5b7dd3a45469e24085f901fd090", "value": "Connecting..." } }, "5b3dac49b72e453c8f6539144eddd6c1": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f081b5b7dd3a45469e24085f901fd090": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "15247f818b3a49fcb62488cadb5bea01": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_0d7daa89824444c19fe01463ed52c13d", "placeholder": "​", "style": "IPY_MODEL_2b6167435bf94917864f0c78b52d5889", "value": "Token is valid (permission: write)." } }, "3f73d0c8d0e347f5bd620983a9f66675": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_403c0f83852f4fae86e8394d449054f8", "placeholder": "​", "style": "IPY_MODEL_9c1173c8d30741c3a05f72a3b5a8595e", "value": "Your token has been saved in your configured git credential helpers (store)." } }, "e569a4fd61e84281b3cf4e8f79a6ec82": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ef57bf882b8b4585a648eb61e961a9c4", "placeholder": "​", "style": "IPY_MODEL_b437a409daba41da9b52782318f33d1c", "value": "Your token has been saved to /root/.cache/huggingface/token" } }, "3037acaa3b08453b8db84ab6846f98ff": { "model_module": "@jupyter-widgets/controls", "model_name": "LabelModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "LabelModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "LabelView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_cbff2a6c04ca479f851bcf802e9e8ec5", "placeholder": "​", "style": "IPY_MODEL_f0b9f838726249bdba2fb896cae4b312", "value": "Login successful" } }, "0d7daa89824444c19fe01463ed52c13d": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "2b6167435bf94917864f0c78b52d5889": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "403c0f83852f4fae86e8394d449054f8": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9c1173c8d30741c3a05f72a3b5a8595e": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "ef57bf882b8b4585a648eb61e961a9c4": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "b437a409daba41da9b52782318f33d1c": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "cbff2a6c04ca479f851bcf802e9e8ec5": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f0b9f838726249bdba2fb896cae4b312": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "nbformat": 4, "nbformat_minor": 0 }