{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 220, "referenced_widgets": [ "d6d7368c1c7b4a549d9a706ee1a62785", "0e22f97db509402a9b4d4a2fa8c80fe0", "475728820f8e4b6fa0c33a1e9989179a", "cf5e926c8c004525b5aad36d821ef928", "9275c5cf7b314dc69419611128cb0c09", "926c9a0562f3455b958c71bd0a138558", "ef276c365d604dcc83b4a0133c6b7652", "3dc315e087f44330badbb6749b0611a9", "bc6c346b95424eb881b793bf6fd2f53e", "c26db3dd5a86405b81f510fd759c3af7", "dae2b5afeee243e682322c1ecb8238e6", "f66e121a24e441c2a4cb32fb87d22632", "1776c0895e7f400f85d3a2123cb573f1", "e7fd82b589eb49aaba73aeafcc340421", "210ec65a874a4f51ab9f059d3de804a9", "c91d89b903ce4f02b635454d3bd87877", "9cba2384346645499516a7923ad6fcef", "491f71a8889c4c7aa0042e99f374be79", "9f60072613d84754a0efe7813d853565", "bf48a3e692ae4e6da5379152f51baa09", "25529d785e9047e1b9bd197a7ec56773", "9dda1a77133c4247bac106a9c4699153" ] }, "id": "Sm-TvQo5chAc", "outputId": "031ba45c-fc02-4ee6-ddd4-eeca67c6f92e" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Initialising HRCS Classifier Pipeline...\n", "Loading model and tokenizer from: NIHRDataInsights/HRCSHealthCategories...\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d6d7368c1c7b4a549d9a706ee1a62785", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Loading weights: 0%| | 0/393 [00:00" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": "download(\"download_d84f50b6-a57a-4840-866b-dc789f372d10\", \"hc_rac_predictions.csv\", 1874)", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Success! Predictions saved to: ./hc_rac_predictions.csv\n" ] } ], "source": [ "\"\"\"\n", "HRCS Health Category & Research Activity Code - Inference Script\n", "Developed by National Institute for Health and Care Research (NIHR)\n", "\n", "This script downloads the trained models from Hugging Face and runs\n", "predictions locally on a provided CSV of research awards.\n", "\n", "Dependencies required:\n", "pip install torch pandas numpy tqdm transformers huggingface_hub\n", "\"\"\"\n", "\n", "import os, json\n", "from typing import List\n", "import numpy as np\n", "import pandas as pd\n", "from tqdm import tqdm\n", "\n", "import torch\n", "from torch.utils.data import Dataset as TorchDataset, DataLoader\n", "from torch.nn.functional import sigmoid\n", "\n", "from transformers import AutoTokenizer, AutoModelForSequenceClassification\n", "from huggingface_hub import hf_hub_download\n", "\n", "# --- USER SETTINGS ---\n", "# Set the path to the folder containing your CSV and the desired filenames\n", "DATA_FOLDERS = [\"./\"] # can input more than one folder if needed\n", "TEST_FILENAME = r\"test_data.csv\"\n", "OUTPUT_FILENAME = \"hc_rac_predictions.csv\"\n", "\n", "# --- HUGGING FACE REPO SETTINGS ---\n", "HC_REPO_ID = \"NIHRDataInsights/HRCSHealthCategories\"\n", "RAC_REPO_ID = \"NIHRDataInsights/HRCSResearchActivityCodes\"\n", "\n", "BATCH_SIZE = 16 # Adjust based on your hardware (use 64+ for GPUs, 2-16 for CPUs)\n", "MAX_LEN = 512\n", "USE_GPU = torch.cuda.is_available()\n", "\n", "# -------------------- DATASET --------------------\n", "class TextDataset(TorchDataset):\n", " \"\"\"\n", " This section takes your spreadsheet and packages it so the AI can read it.\n", " It combines the 'AwardTitle' and 'AwardAbstract' together into 'text' (to be categorised).\n", " \"\"\"\n", " def __init__(self, df: pd.DataFrame, tokenizer, max_len: int = 512):\n", " df = df.copy()\n", " df[\"text\"] = (\n", " df[\"AwardTitle\"].fillna(\"\").astype(str) + \"\\n\" +\n", " df[\"AwardAbstract\"].fillna(\"\").astype(str)\n", " )\n", " self.texts = df[\"text\"].tolist()\n", " self.tokenizer = tokenizer\n", " self.max_len = max_len\n", "\n", " def __len__(self):\n", " return len(self.texts)\n", "\n", " def __getitem__(self, idx):\n", " enc = self.tokenizer(\n", " self.texts[idx],\n", " truncation=True, # cuts if too long\n", " padding=\"max_length\", # adds spaces if under limit\n", " max_length=self.max_len,\n", " return_tensors=\"pt\"\n", " )\n", " return {k: v.squeeze(0) for k, v in enc.items()}\n", "\n", "# -------------------- MODEL LOADING --------------------\n", "def load_hf_model(repo_id: str):\n", " \"\"\"\n", " This section downloads the models from hugging face and the optimal thresholds.\n", " \"\"\"\n", " print(f\"Loading model and tokenizer from: {repo_id}...\")\n", "\n", " tok = AutoTokenizer.from_pretrained(repo_id, use_fast=True)\n", " model = AutoModelForSequenceClassification.from_pretrained(repo_id)\n", "\n", " model.eval()\n", " device = torch.device(\"cuda\" if USE_GPU else \"cpu\")\n", " model.to(device)\n", "\n", " # Download custom metadata.json from the repo for specific threshold values\n", " try:\n", " meta_path = hf_hub_download(repo_id=repo_id, filename=\"metadata.json\")\n", " with open(meta_path, \"r\") as f:\n", " meta = json.load(f)\n", " labels = meta.get(\"labels\")\n", " thresholds = np.array(meta.get(\"optimal_thresholds\", []), dtype=float)\n", " except Exception as e:\n", " print(f\"Warning: Could not load metadata.json from {repo_id}. {e}\")\n", " labels, thresholds = None, None\n", "\n", " if labels is None:\n", " num_labels = int(model.config.num_labels)\n", " labels = [model.config.id2label.get(i, f\"L{i}\") for i in range(num_labels)]\n", "\n", " if thresholds is None or len(thresholds) != len(labels):\n", " print(f\"Using default 0.5 threshold for {repo_id}\")\n", " thresholds = np.full(len(labels), 0.5, dtype=float)\n", "\n", " return tok, model, labels, thresholds\n", "\n", "# -------------------- INFERENCE & BUILD --------------------\n", "def predict(model, dataloader: DataLoader, thresholds: np.ndarray):\n", " device = next(model.parameters()).device\n", " all_logits = []\n", "\n", " with torch.no_grad():\n", " for batch in tqdm(dataloader, desc=\"Inferencing\"):\n", " inputs = {k: v.to(device) for k, v in batch.items()}\n", " logits = model(**inputs).logits\n", " all_logits.append(logits.cpu())\n", "\n", " logits = torch.cat(all_logits, dim=0).numpy()\n", " probs = sigmoid(torch.tensor(logits)).numpy()\n", " preds = (probs > thresholds.reshape(1, -1)).astype(int)\n", " return logits, probs, preds\n", "\n", "def build_outputs(df, logits, probs, preds, label_list, thresholds, prefix: str):\n", " \"\"\"\n", " This section builds the final columns for your spreadsheet.\n", " Crucially, it calculates the 'Smallest Logit Diff'.\n", " This can be considered an 'AI Certainty Score'. The closer this number is to 0,\n", " the more confused the AI was. Please see the Hugging Face READMEs for each model which contains details on the impact on performance.\n", " \"\"\"\n", " # Clip thresholds to avoid log(0) warnings\n", " safe_thresholds = np.clip(thresholds, 1e-7, 1 - 1e-7)\n", " thr_logits = np.log(safe_thresholds / (1 - safe_thresholds))\n", "\n", " rows = {}\n", " for i in range(len(df)):\n", " logit_row = logits[i]\n", " pred_row = preds[i]\n", "\n", " # gather categories labelled as 'yes'\n", " chosen = [label_list[j] for j, val in enumerate(pred_row) if val == 1]\n", "\n", " # Calculate the uncertainty score\n", " smallest_diff = float(np.min(np.abs(logit_row - thr_logits)))\n", " rows[i] = {\n", " f\"{prefix}_PredictedLabels\": \";\".join(chosen),\n", " f\"{prefix}_SmallestLogitDiff\": smallest_diff\n", " }\n", " return rows\n", "\n", "# -------------------- PROCESS FOLDER --------------------\n", "def run_folder(data_folder: str, hc_assets, rac_assets):\n", " \"\"\"\n", " This function opens your specific folder (selected in the first section), reads your CSV, passes it through\n", " both AI models (Health Categories and Research Activity Codes), and saves the result.\n", " \"\"\"\n", " test_file = os.path.join(data_folder, TEST_FILENAME)\n", " output_file = os.path.join(data_folder, OUTPUT_FILENAME)\n", "\n", " if not os.path.exists(test_file):\n", " print(f\"Skipping: {test_file} not found in {data_folder}.\")\n", " return\n", "\n", " print(f\"\\n=== Processing folder: {data_folder} ===\")\n", " df = pd.read_csv(test_file).reset_index(drop=True)\n", "\n", " # Validate Input Data contains title and abstract\n", " if \"AwardTitle\" not in df.columns or \"AwardAbstract\" not in df.columns:\n", " print(f\"ERROR: '{TEST_FILENAME}' must contain 'AwardTitle' and 'AwardAbstract' columns. Skipping.\")\n", " return\n", "\n", " # HC Inference\n", " hc_tok, hc_model, hc_labels, hc_thr = hc_assets\n", " hc_loader = DataLoader(TextDataset(df, hc_tok), batch_size=BATCH_SIZE)\n", " hc_logits, _, hc_preds = predict(hc_model, hc_loader, hc_thr)\n", " hc_rows = build_outputs(df, hc_logits, None, hc_preds, hc_labels, hc_thr, \"HC\")\n", "\n", " # RAC Inference\n", " rac_tok, rac_model, rac_labels, rac_thr = rac_assets\n", " rac_loader = DataLoader(TextDataset(df, rac_tok), batch_size=BATCH_SIZE)\n", " rac_logits, _, rac_preds = predict(rac_model, rac_loader, rac_thr)\n", " rac_rows = build_outputs(df, rac_logits, None, rac_preds, rac_labels, rac_thr, \"RAC\")\n", "\n", " # Construct final dataframe\n", " output_data = []\n", " for i in range(len(df)):\n", " row = {\n", " \"ID\": df.loc[i, \"ID\"] if \"ID\" in df.columns else i,\n", " \"FunderAcronym\": df.loc[i, \"FunderAcronym\"] if \"FunderAcronym\" in df.columns else \"\",\n", " \"AwardTitle\": df.loc[i, \"AwardTitle\"],\n", " \"AwardAbstract\": df.loc[i, \"AwardAbstract\"],\n", " **hc_rows[i],\n", " **rac_rows[i]\n", " }\n", " output_data.append(row)\n", "\n", " pd.DataFrame(output_data).to_csv(OUTPUT_FILENAME, index=False)\n", " print(f\"Success! Predictions saved to: {output_file}\")\n", "\n", "# -------------------- MAIN --------------------\n", "if __name__ == \"__main__\":\n", " print(\"Initialising HRCS Classifier Pipeline...\")\n", "\n", " # Load models once outside the loop to save memory/time\n", " hc_assets = load_hf_model(HC_REPO_ID)\n", " rac_assets = load_hf_model(RAC_REPO_ID)\n", "\n", " for folder in DATA_FOLDERS:\n", " run_folder(folder, hc_assets, rac_assets)" ] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "name": "python" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "0e22f97db509402a9b4d4a2fa8c80fe0": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "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_926c9a0562f3455b958c71bd0a138558", "placeholder": "​", "style": "IPY_MODEL_ef276c365d604dcc83b4a0133c6b7652", "value": "Loading weights: 100%" } }, "1776c0895e7f400f85d3a2123cb573f1": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "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_9cba2384346645499516a7923ad6fcef", "placeholder": "​", "style": "IPY_MODEL_491f71a8889c4c7aa0042e99f374be79", "value": "Loading weights: 100%" } }, "210ec65a874a4f51ab9f059d3de804a9": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "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_25529d785e9047e1b9bd197a7ec56773", "placeholder": "​", "style": "IPY_MODEL_9dda1a77133c4247bac106a9c4699153", "value": " 393/393 [00:00<00:00, 581.79it/s, Materializing param=classifier.weight]" } }, "25529d785e9047e1b9bd197a7ec56773": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "3dc315e087f44330badbb6749b0611a9": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "475728820f8e4b6fa0c33a1e9989179a": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "FloatProgressModel", "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_3dc315e087f44330badbb6749b0611a9", "max": 393, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_bc6c346b95424eb881b793bf6fd2f53e", "value": 393 } }, "491f71a8889c4c7aa0042e99f374be79": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "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": "" } }, "926c9a0562f3455b958c71bd0a138558": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "9275c5cf7b314dc69419611128cb0c09": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "9cba2384346645499516a7923ad6fcef": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "9dda1a77133c4247bac106a9c4699153": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "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": "" } }, "9f60072613d84754a0efe7813d853565": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "bc6c346b95424eb881b793bf6fd2f53e": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "ProgressStyleModel", "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": "" } }, "bf48a3e692ae4e6da5379152f51baa09": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "ProgressStyleModel", "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": "" } }, "c26db3dd5a86405b81f510fd759c3af7": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "c91d89b903ce4f02b635454d3bd87877": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "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 } }, "cf5e926c8c004525b5aad36d821ef928": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "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_c26db3dd5a86405b81f510fd759c3af7", "placeholder": "​", "style": "IPY_MODEL_dae2b5afeee243e682322c1ecb8238e6", "value": " 393/393 [00:01<00:00, 353.83it/s, Materializing param=classifier.weight]" } }, "d6d7368c1c7b4a549d9a706ee1a62785": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HBoxModel", "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_0e22f97db509402a9b4d4a2fa8c80fe0", "IPY_MODEL_475728820f8e4b6fa0c33a1e9989179a", "IPY_MODEL_cf5e926c8c004525b5aad36d821ef928" ], "layout": "IPY_MODEL_9275c5cf7b314dc69419611128cb0c09" } }, "dae2b5afeee243e682322c1ecb8238e6": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "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": "" } }, "e7fd82b589eb49aaba73aeafcc340421": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "FloatProgressModel", "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_9f60072613d84754a0efe7813d853565", "max": 393, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_bf48a3e692ae4e6da5379152f51baa09", "value": 393 } }, "ef276c365d604dcc83b4a0133c6b7652": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "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": "" } }, "f66e121a24e441c2a4cb32fb87d22632": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HBoxModel", "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_1776c0895e7f400f85d3a2123cb573f1", "IPY_MODEL_e7fd82b589eb49aaba73aeafcc340421", "IPY_MODEL_210ec65a874a4f51ab9f059d3de804a9" ], "layout": "IPY_MODEL_c91d89b903ce4f02b635454d3bd87877" } } } } }, "nbformat": 4, "nbformat_minor": 0 }