{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "JmYRMwEOYkbU" }, "source": [ "# `Fire Detect - ViT`" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "c6rbUun0tdC5" }, "outputs": [], "source": [ "!pip install evaluate datasets accelerate\n", "!pip install git+https://github.com/huggingface/transformers.git" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "id": "dhLosa2Utm5M" }, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings(\"ignore\")\n", "\n", "import gc\n", "import numpy as np\n", "import pandas as pd\n", "import itertools\n", "from collections import Counter\n", "import matplotlib.pyplot as plt\n", "from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, classification_report, f1_score\n", "from imblearn.over_sampling import RandomOverSampler\n", "import evaluate\n", "from datasets import Dataset, Image, ClassLabel\n", "from transformers import (\n", " TrainingArguments,\n", " Trainer,\n", " ViTImageProcessor,\n", " ViTForImageClassification,\n", " DefaultDataCollator\n", ")\n", "import torch\n", "from torch.utils.data import DataLoader\n", "from torchvision.transforms import (\n", " CenterCrop,\n", " Compose,\n", " Normalize,\n", " RandomRotation,\n", " RandomResizedCrop,\n", " RandomHorizontalFlip,\n", " RandomAdjustSharpness,\n", " Resize,\n", " ToTensor\n", ")\n", "from PIL import Image as PILImage\n", "from PIL import ImageFile\n", "\n", "# Enable loading truncated images\n", "ImageFile.LOAD_TRUNCATED_IMAGES = True" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "20RJuU8_uY2k" }, "outputs": [], "source": [ "from datasets import load_dataset\n", "dataset = load_dataset(\"--your--dataset-goes--here\", split=\"train\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "id": "o8rgwG0nuc00" }, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "file_names = []\n", "labels = []\n", "\n", "for example in dataset:\n", " file_path = str(example['image']) # Convert the image object to a string or path\n", " label = example['label'] # Get the label\n", "\n", " file_names.append(file_path) # Add the file path to the list\n", " labels.append(label) # Add the label to the list" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "Yz8qs87tuhjs" }, "outputs": [], "source": [ "# Print the total number of file names and labels\n", "print(len(file_names), len(labels))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "id": "7CW5l8Td_V-4" }, "outputs": [], "source": [ "# Create a pandas dataframe from the collected file names and labels\n", "df = pd.DataFrame.from_dict({\"image\": file_names, \"label\": labels})" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "9SZz49oNBSHf" }, "outputs": [], "source": [ "print(df.shape)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "ZubCrfrhBZGo" }, "outputs": [], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "oFwJ-2_B_br5" }, "outputs": [], "source": [ "df['label'].unique()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "ZzX_P-onunr7" }, "outputs": [], "source": [ "y = df[['label']]\n", "df = df.drop(['label'], axis=1)\n", "ros = RandomOverSampler(random_state=83)\n", "df, y_resampled = ros.fit_resample(df, y)\n", "del y\n", "df['label'] = y_resampled\n", "del y_resampled\n", "gc.collect()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "id": "WaJ_C30L_N_L" }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "# Create a DataFrame from the collected file names and labels\n", "df = pd.DataFrame.from_dict({\"image\": file_names, \"label\": labels})" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "ha4Bpgoz7dfu" }, "outputs": [], "source": [ "dataset[10][\"image\"]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "-MfUvn2A-tBc" }, "outputs": [], "source": [ "labels_subset = labels[:5]\n", "\n", "# Printing the subset of labels to inspect the content.\n", "print(labels_subset)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "id": "9u1W0MBhBpMA" }, "outputs": [], "source": [ "# Define the new list of unique labels\n", "labels_list = ['Fire Needed Action', 'Normal Conditions', 'Smoky Environment']\n", "\n", "# Initialize dictionaries to map labels to IDs and vice versa\n", "label2id, id2label = {}, {}\n", "for i, label in enumerate(labels_list):\n", " label2id[label] = i\n", " id2label[i] = label\n", "\n", "# Create ClassLabels object\n", "ClassLabels = ClassLabel(num_classes=len(labels_list), names=labels_list)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "4CfU5GJkByam", "outputId": "6d206be1-ad03-41c3-a6d4-7127f490f037" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Mapping of IDs to Labels: {0: 'Fire Needed Action', 1: 'Normal Conditions', 2: 'Smoky Environment'} \n", "\n", "Mapping of Labels to IDs: {'Fire Needed Action': 0, 'Normal Conditions': 1, 'Smoky Environment': 2}\n" ] } ], "source": [ "# Print the resulting dictionaries for reference\n", "print(\"Mapping of IDs to Labels:\", id2label, '\\n')\n", "print(\"Mapping of Labels to IDs:\", label2id)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 81, "referenced_widgets": [ "482c35ac85834319987d7b901227d688", "f1ebc501cb5f4f5e83b29076f5aff39b", "a145e3c6cd854b3aa47cf66e36e4cb04", "4104f20f77494fa1aea8aa06e87697a6", "b8925ceffe9144b88bf53389732f5307", "38050770fce14be7b51db96afc1d6785", "6c69d5012544464e8ec4f40ffb3d89f3", "2eb097c8ba994ce691a6bec25c09bf78", "3fab640eea2347588b7c2d692ca1c2ee", "36aa6bf214f7415f9fbce160e18c8822", "abd15e0e6fb94080862d151f4eba260c", "e821343bf5d54850b0d53fc572cbf7e0", "4f31647cf0f0465380c727a913476014", "3c27508b812f4e8f92d83c61d0ffbcc4", "18dcc402180e4cb6b1cb58710826f42b", "52d346a2ed8b4b9095e55a45c2a50522", "1211ac4560ca4710af89b2efdf22171a", "58709f429a31423aa848f64bb9badfe3", "88b5d89d805a483f9b251be0e54d02f3", "1f5a57aed02c47939241ec2af541df73", "0747a395d3e84e64bd8ea81a824e3061", "e4f04ffcb3e94a67a76d3b4ec0977375" ] }, "id": "M9XI2VNYB35G", "outputId": "b39d946d-841f-493b-f023-11f88fba4a7c" }, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "Map: 0%| | 0/6060 [00:00 thresh else \"black\")\n", "\n", " # Label the axes\n", " plt.ylabel('True label')\n", " plt.xlabel('Predicted label')\n", "\n", " # Ensure the plot layout is tight\n", " plt.tight_layout()\n", " # Display the plot\n", " plt.show()\n", "\n", "# Calculate accuracy and F1 score\n", "accuracy = accuracy_score(y_true, y_pred)\n", "f1 = f1_score(y_true, y_pred, average='macro')\n", "\n", "# Display accuracy and F1 score\n", "print(f\"Accuracy: {accuracy:.4f}\")\n", "print(f\"F1 Score: {f1:.4f}\")\n", "\n", "# Get the confusion matrix if there are a small number of labels\n", "if len(labels_list) <= 150:\n", " # Compute the confusion matrix\n", " cm = confusion_matrix(y_true, y_pred)\n", "\n", " # Plot the confusion matrix using the defined function\n", " plot_confusion_matrix(cm, labels_list, figsize=(8, 6))\n", "\n", "# Finally, display classification report\n", "print()\n", "print(\"Classification report:\")\n", "print()\n", "print(classification_report(y_true, y_pred, target_names=labels_list, digits=4))" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "id": "Qj1F9FLgIedG" }, "outputs": [], "source": [ "trainer.save_model()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "F-jYKwyWIiue" }, "outputs": [], "source": [ "# Import the 'pipeline' function from the 'transformers' library.\n", "from transformers import pipeline\n", "pipe = pipeline('image-classification', model=model_name, device=0)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "Iy0WsizHIm_m" }, "outputs": [], "source": [ "image = test_data[1][\"image\"]\n", "image" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "TG7rBUMnIpXl" }, "outputs": [], "source": [ "pipe(image)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "CtTHa2_DIq0x" }, "outputs": [], "source": [ "id2label[test_data[1][\"label\"]]" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 17, "referenced_widgets": [ "d35991d81d964d1c91f7980206bcde8a", "e20b7b3e6bd84b61bdf797b89491a186", "6595a7dea024482e9739c99557b4b7e1", "23015c067ab24d9ab1eed28a031a167c", "62609b47efc744c28b3c95c7f0837e4f", "bad52f9d97e444f698772960c7ddf05c", "90a4e2b717ec452f868467f31c55052d", "b7e8db77d1e64878a2a198233892d1e0", "ae01737748d84f57ade069c2a66e95d8", "1bdc9c959a5b4a0abc2bafb6647e8645", "7e41ea4d67684b16b2d559b7a660b6d3", "160bbd00f1f44be58a418d005e7dcde5", "107b31ff64ce43febd9928e28953cc33", "804f29bc6f804fad8a6fad1cca73ba47", "2dac1441168345f89d10cfc88863f5eb", "8a2eba49a0c647e78e01752342df9432", "7c81b574f418477fbbb54209c2176904", "457fa3d625c64c128eb8cc6f8b28e8cd", "541b70018449416bbf776894239874a7", "ea8be29437dd4f22a8f21004b9aa6db5" ] }, "id": "BYY0rKBJIsgI", "outputId": "cae1d0df-4220-4b61-fa17-cfabf0f9e9f1" }, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "VBox(children=(HTML(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.
" } }, "6595a7dea024482e9739c99557b4b7e1": { "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_1bdc9c959a5b4a0abc2bafb6647e8645", "placeholder": "​", "style": "IPY_MODEL_7e41ea4d67684b16b2d559b7a660b6d3", "value": "" } }, "23015c067ab24d9ab1eed28a031a167c": { "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_160bbd00f1f44be58a418d005e7dcde5", "style": "IPY_MODEL_107b31ff64ce43febd9928e28953cc33", "value": true } }, "62609b47efc744c28b3c95c7f0837e4f": { "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_804f29bc6f804fad8a6fad1cca73ba47", "style": "IPY_MODEL_2dac1441168345f89d10cfc88863f5eb", "tooltip": "" } }, "bad52f9d97e444f698772960c7ddf05c": { "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_8a2eba49a0c647e78e01752342df9432", "placeholder": "​", "style": "IPY_MODEL_7c81b574f418477fbbb54209c2176904", "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. " } }, "90a4e2b717ec452f868467f31c55052d": { "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%" } }, "b7e8db77d1e64878a2a198233892d1e0": { "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 } }, "ae01737748d84f57ade069c2a66e95d8": { "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": "" } }, "1bdc9c959a5b4a0abc2bafb6647e8645": { "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 } }, "7e41ea4d67684b16b2d559b7a660b6d3": { "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": "" } }, "160bbd00f1f44be58a418d005e7dcde5": { "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 } }, "107b31ff64ce43febd9928e28953cc33": { "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": "" } }, "804f29bc6f804fad8a6fad1cca73ba47": { "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 } }, "2dac1441168345f89d10cfc88863f5eb": { "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": "" } }, "8a2eba49a0c647e78e01752342df9432": { "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 } }, "7c81b574f418477fbbb54209c2176904": { "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": "" } }, "457fa3d625c64c128eb8cc6f8b28e8cd": { "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_541b70018449416bbf776894239874a7", "placeholder": "​", "style": "IPY_MODEL_ea8be29437dd4f22a8f21004b9aa6db5", "value": "Connecting..." } }, "541b70018449416bbf776894239874a7": { "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 } }, "ea8be29437dd4f22a8f21004b9aa6db5": { "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": "" } }, "6a7eef4c3c284b6b8360472f4181637d": { "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": [], "layout": "IPY_MODEL_9988a5bde60445dbbbe3dc3ff86d4427" } }, "aa7f3abb28ed47caa29a0b7f97a4984c": { "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_63783714cf554617889a9e126f88ee68", "placeholder": "​", "style": "IPY_MODEL_fb1bf758aebe4329b00165fbf7ed9fd2", "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.
" } }, "426b0a2dc82a413fa4be327943bb11f2": { "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_1de13e42bb6a486baeec20547a76f16f", "placeholder": "​", "style": "IPY_MODEL_1bfb58a8a08d48cabf6848de3df1fc38", "value": "" } }, "f6f8bd7e7c314cdebb4bb667de55941a": { "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_16f53a374ad84a70aa629be78274c11c", "style": "IPY_MODEL_804c630b4b15496981edb4915c06e5ba", "value": true } }, "b1bc3aa238854c7d83953b331cd4e034": { "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_72def696fbc0475b93395463726f9cf4", "style": "IPY_MODEL_1bcbbc9f8e0040aab27c69c8fa309bae", "tooltip": "" } }, "0b141ad71e2f4b81ac013cdde0454d1d": { "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_714b64046b1e44ab867d5841460e0968", "placeholder": "​", "style": "IPY_MODEL_279552a8facd4053acae9d80e2860706", "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. " } }, "9988a5bde60445dbbbe3dc3ff86d4427": { "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%" } }, "63783714cf554617889a9e126f88ee68": { "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 } }, "fb1bf758aebe4329b00165fbf7ed9fd2": { "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": "" } }, "1de13e42bb6a486baeec20547a76f16f": { "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 } }, "1bfb58a8a08d48cabf6848de3df1fc38": { "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": "" } }, "16f53a374ad84a70aa629be78274c11c": { "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 } }, "804c630b4b15496981edb4915c06e5ba": { "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": "" } }, "72def696fbc0475b93395463726f9cf4": { "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 } }, "1bcbbc9f8e0040aab27c69c8fa309bae": { "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": "" } }, "714b64046b1e44ab867d5841460e0968": { "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 } }, "279552a8facd4053acae9d80e2860706": { "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": "" } }, "2b8d05b51b6e456ab3c23047a31a1afa": { "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_ba407f07b6dd4bb991094a70b1baca03", "placeholder": "​", "style": "IPY_MODEL_b402a3d552774881ac456325cb7245f1", "value": "Connecting..." } }, "ba407f07b6dd4bb991094a70b1baca03": { "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 } }, "b402a3d552774881ac456325cb7245f1": { "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 }