{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-000"
   },
   "source": [
    "# Can decision-model activations improve guardrail decisions?\n",
    "## A Colab experiment for raxIT Labs — Kev 4B\n",
    "\n",
    "This adapts Aditya's ARENA truth-probing workflow to **block / allow under a fixed policy**.\n",
    "We load the **trained Kev checkpoint, including its LoRA and decision head**. We do not substitute its Qwen base.\n",
    "\n",
    "The question is: **Do intermediate activations contain useful policy-violation information that a supervised linear readout can recover better than the model's native head?**\n",
    "\n",
    "Run on a **fresh Colab GPU runtime**. A100 is recommended for speed; start with a T4 if necessary. The 4B backbone needs more memory than Strands 2B; an A100 is a practical choice for this run. Weights alone do not determine peak VRAM: question batches and sequence lengths also matter. No paid inference APIs or API keys are needed. Colab compute still uses your credits.\n",
    "\n",
    "**First run:** install cell → restart session → run from cell 2 onward. `SMOKE=True` uses a small grouped sample to check the entire pipeline. For research results, set `SMOKE=False` before extraction, then run the analysis again from a fresh output directory. Never report the smoke run as a benchmark result.\n",
    "\n",
    "Graphs appear only after inference: layer sweep, PCA, test ROC, confusion matrices, performance with group-bootstrap intervals, per-topic scores, and order-sensitivity plots. All graphs and results are exported in a ZIP.\n",
    "\n",
    "**Validation status:** notebook Python was syntax-checked; data splitting, probe fitting, scoring, and graph generation were checked locally with real metadata and synthetic feature matrices. The native loader and extraction APIs were checked against the pinned Kev source. The pretrained GPU forward pass was not run in the authoring environment. Results are intentionally empty until you run Colab."
   ],
   "id": "kev-cell-000"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-001"
   },
   "source": [
    "### Models on the board with downloadable weights (checked 13 October 2026)\n",
    "\n",
    "| Board system | Public artifact | Practical first experiment |\n",
    "|---|---|---|\n",
    "| Strands Decider 2B | `StrandsAgents/strands-decider-2B-hobson-v19` | This notebook; native loader plus layer hooks |\n",
    "| Kev 0.8B / 4B / 9B | `jaredpalmer/kev-0.8b`, `kev-4b`, `kev-9b` | Native Kev loader; adapters and separate head |\n",
    "| Open-Jev 2B | `ZefanCai/Open-Jev-2B` | Native Open-Jev loader; adapters and separate head |\n",
    "| Laya | `convaiinnovations/laya` | Small encoder; option-marker / masked pooling, not a causal last-token recipe |\n",
    "| Clef Flash / Clef | `Cloudflare/clef-flash`, `Cloudflare/clef` | 9B / 27B; native joint-schema head |\n",
    "| Decisions API · Perplexity | `perplexity-ai/pplx-decider-v1-27b` | 27B; native loader; vendor documents ~49 GiB weights plus working memory |\n",
    "\n",
    "Jev and OpenAI's hosted Decisions API do not expose the internal activations required here. A hosted API can serve a model whose weights are also public; its HTTP response still does not provide hidden states. Local results need not exactly match hosted serving.\n",
    "\n",
    "Primary sources:\n",
    "- [raxIT board](https://dm-as-guardrails.raxitlabs.com/), [code](https://github.com/raxITlabs/decision-models-as-guardrails), [dataset](https://huggingface.co/datasets/raxITLabs/decision-models-as-guardrails)\n",
    "- [Strands model card](https://huggingface.co/StrandsAgents/strands-decider-2B-hobson-v19), [implementation](https://github.com/strands-labs/strands-decider)\n",
    "- [Kev](https://github.com/jaredpalmer/kev), [Open-Jev](https://huggingface.co/ZefanCai/Open-Jev-2B), [Laya](https://huggingface.co/convaiinnovations/laya)\n",
    "- [Clef](https://huggingface.co/Cloudflare/clef), [Clef Flash](https://huggingface.co/Cloudflare/clef-flash), [Perplexity](https://huggingface.co/perplexity-ai/pplx-decider-v1-27b), [TypeSafe access](https://docs.typesafe.ai/models)"
   ],
   "id": "kev-cell-001"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-002"
   },
   "source": [
    "### 1. Install once, then restart the Colab session\n",
    "\n",
    "Use a fresh runtime rather than the ARENA environment; its Transformers 4.56 pin does not support this loader.\n",
    "Install Jared Palmer’s Kev from GitHub: the PyPI package called `kev` is an unrelated ORM. The repository code, model adapter/head, dataset, and policy questions are pinned below. Dependency versions are recorded in the run manifest. Optional fast kernels can make hybrid Qwen layers faster, but the default uses the reference implementation to avoid a CUDA compilation requirement."
   ],
   "id": "kev-cell-002"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "kev-cell-003",
    "outputId": "f7cc9b28-66fe-40ef-f755-af8a0f2c44fa"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "import subprocess, sys\n",
    "KEV_CODE_REV = \"85ccf56a0afb952323c621055b02876e8498d60c\"\n",
    "# Install the correct Kev project, not the unrelated PyPI ORM.\n",
    "subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"-q\",\n",
    "    f\"git+https://github.com/jaredpalmer/kev.git@{KEV_CODE_REV}\",\n",
    "    \"pandas>=2.2,<3\", \"matplotlib>=3.8,<4\", \"tqdm>=4.66\"])\n",
    "# PEFT rejects Colab's older optional torchao; this experiment does not use it.\n",
    "subprocess.check_call([sys.executable, \"-m\", \"pip\", \"uninstall\", \"-y\", \"torchao\"])\n",
    "print(\"Installation complete. Use Runtime > Restart session, then run from configuration onward.\")"
   ],
   "id": "kev-cell-003"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-004"
   },
   "source": [
    "### 2. Configuration and evaluation contract\n",
    "\n",
    "`expected=yes` means **block**; `expected=no` means **allow**. The policy, not universal factual truth or intrinsic harmfulness, defines the label. Some benign text is blocked under a denied-topic policy.\n",
    "\n",
    "We use the topic suite because its pinned release has 118 dev and 540 test rows with readable text. Many other suites ship mainly IDs and need reconstruction from upstream sources. Missing text is counted and excluded, never filled with labels or IDs.\n",
    "\n",
    "Training and validation come only from the published `dev` split. Related pairs stay together using `group`. Layer, pooling, LR regularization and threshold are selected on validation; test is used only afterward. This is a **new supervised probing experiment on a readable subset**, not a reproduction of the board's unsupervised default ranking or its overall score."
   ],
   "id": "kev-cell-004"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "kev-cell-005",
    "outputId": "666a6b40-3a28-4e73-a1c1-59404e491006"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "import os\n",
    "os.environ[\"USE_TF\"] = \"0\"\n",
    "import json, hashlib, platform, time, copy, random, zipfile, importlib.metadata as im\n",
    "from pathlib import Path\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from IPython.display import display\n",
    "from tqdm.auto import tqdm\n",
    "import torch\n",
    "from huggingface_hub import hf_hub_download, snapshot_download\n",
    "from sklearn.model_selection import GroupShuffleSplit\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "from sklearn.pipeline import make_pipeline\n",
    "from sklearn.feature_extraction.text import TfidfVectorizer\n",
    "from sklearn.decomposition import PCA\n",
    "from sklearn.metrics import (roc_auc_score, roc_curve, balanced_accuracy_score,\n",
    "    accuracy_score, confusion_matrix, average_precision_score, brier_score_loss)\n",
    "from kev.checkpoint import Checkpoint, LoadOptions\n",
    "from kev.api import SystemOneRequest, to_record\n",
    "from kev.model import rows_of\n",
    "\n",
    "SEED = 42\n",
    "SMOKE = True\n",
    "QUESTION_BATCH = 1\n",
    "RUN_ROBUSTNESS = True\n",
    "QUESTION_BATCH = 2           # Independent question sequences per forward; 1 if OOM.\n",
    "N_BOOT = 500                 # Increase to 2000 for the final report.\n",
    "MODEL_ID = \"jaredpalmer/kev-4b\"\n",
    "MODEL_REV = \"6cfce5c2fa4b4bd64026336ab649c5ca78857d52\"  # v1.0 resolved to a fixed commit\n",
    "KEV_CODE_REV = \"85ccf56a0afb952323c621055b02876e8498d60c\"\n",
    "BENCHMARK_REV = \"38b70dc2991e52b62b1e05def887e268e5ac4a7c\"\n",
    "DATA_ID = \"raxITLabs/decision-models-as-guardrails\"\n",
    "DATA_REV = \"13beb711a4c2de3f9652bab02570c7c439a2f79b\"\n",
    "OUT = Path(\"/content/raxit_kev4b_probe_smoke\" if SMOKE else \"/content/raxit_kev4b_probe_full\")\n",
    "OUT.mkdir(parents=True, exist_ok=True)\n",
    "random.seed(SEED); np.random.seed(SEED); torch.manual_seed(SEED)\n",
    "assert torch.cuda.is_available(), \"Select a GPU in Colab: Runtime > Change runtime type.\"\n",
    "DEVICE = \"cuda\"\n",
    "DTYPE = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16\n",
    "print(torch.cuda.get_device_name(0), \"| dtype:\", DTYPE, \"| smoke:\", SMOKE)\n",
    "print(\"No network calls to a paid model endpoint are made by this notebook.\")\n",
    "\n",
    "def savefig(name):\n",
    "    plt.tight_layout()\n",
    "    plt.savefig(OUT / f\"{name}.png\", dpi=180, bbox_inches=\"tight\")\n",
    "    plt.show()"
   ],
   "id": "kev-cell-005"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-006"
   },
   "source": [
    "### 3. Load rows and the exact frozen policy questions\n",
    "\n",
    "Only `state` is sent to the model. Expected labels, rationales, proposed labels, provenance, source IDs and topic tags never enter the prompt. Topic tags are used only for the later evaluation breakdown."
   ],
   "id": "kev-cell-006"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 213
    },
    "id": "kev-cell-007",
    "outputId": "0c28c428-4f9b-4a69-dfac-8395b06fc908"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "import urllib.request\n",
    "qurl = (f\"https://raw.githubusercontent.com/raxITlabs/decision-models-as-guardrails/\"\n",
    "        f\"{BENCHMARK_REV}/benchmark/question_sets/e2/f3-topics.json\")\n",
    "with urllib.request.urlopen(qurl, timeout=60) as response:\n",
    "    QSET = json.load(response)\n",
    "QKEYS = list(QSET[\"decision\"])\n",
    "assert all(QSET[\"questions\"][k][\"type\"] == \"noul\" for k in QKEYS)\n",
    "(OUT / \"frozen_questions.json\").write_text(json.dumps(QSET, indent=2))\n",
    "\n",
    "row_audit = []\n",
    "def load_rows(split):\n",
    "    path = hf_hub_download(DATA_ID, f\"data/denied_topics/{split}.jsonl\",\n",
    "                          repo_type=\"dataset\", revision=DATA_REV)\n",
    "    raw = [json.loads(s) for s in Path(path).read_text().splitlines() if s.strip()]\n",
    "    rows = []\n",
    "    for r in raw:\n",
    "        text = (r.get(\"state\") or {}).get(\"text\")\n",
    "        if not isinstance(text, str) or not text.strip():\n",
    "            continue\n",
    "        if r.get(\"expected\") not in (\"yes\", \"no\"):\n",
    "            continue\n",
    "        # Exact state fields preserved; no metadata is concatenated into it.\n",
    "        state = dict(r[\"state\"])\n",
    "        fingerprint = hashlib.sha256(json.dumps(state, sort_keys=True,\n",
    "            ensure_ascii=False).encode()).hexdigest()\n",
    "        rows.append(dict(id=r[\"id\"], group=r.get(\"group\") or r[\"id\"],\n",
    "            y=int(r[\"expected\"] == \"yes\"), state=state,\n",
    "            topic=(r.get(\"attribute\") or {}).get(\"topic\") or \"Other\",\n",
    "            source=(r.get(\"provenance\") or {}).get(\"source\", \"unknown\"),\n",
    "            state_hash=fingerprint))\n",
    "    row_audit.append(dict(split=split, total=len(raw), readable=len(rows),\n",
    "                          omitted=len(raw)-len(rows)))\n",
    "    return pd.DataFrame(rows)\n",
    "\n",
    "dev = load_rows(\"dev\")\n",
    "# Collapse exact duplicate model inputs, refusing contradictory labels.\n",
    "def dedupe(df):\n",
    "    assert df.groupby(\"state_hash\").y.nunique().max() == 1, \"Conflicting labels for identical input.\"\n",
    "    return df.drop_duplicates(\"state_hash\").reset_index(drop=True)\n",
    "dev = dedupe(dev)\n",
    "# Grouped split is fixed before any activations or performance are inspected.\n",
    "for seed in range(SEED, SEED + 100):\n",
    "    tr, va = next(GroupShuffleSplit(n_splits=1, test_size=.25,\n",
    "                                   random_state=seed).split(dev, dev.y, dev.group))\n",
    "    if dev.iloc[tr].y.nunique() == 2 and dev.iloc[va].y.nunique() == 2:\n",
    "        break\n",
    "else:\n",
    "    raise ValueError(\"Could not create a two-class grouped validation split.\")\n",
    "train = dev.iloc[tr].reset_index(drop=True)\n",
    "valid = dev.iloc[va].reset_index(drop=True)\n",
    "\n",
    "def small_group_sample(df, n_groups):\n",
    "    # Include whole groups; keep sampling if needed to obtain both classes.\n",
    "    groups = np.random.default_rng(SEED).permutation(df.group.unique())\n",
    "    for n in range(min(n_groups, len(groups)), len(groups)+1):\n",
    "        sampled = df[df.group.isin(groups[:n])].reset_index(drop=True)\n",
    "        if sampled.y.nunique() == 2:\n",
    "            return sampled\n",
    "    raise ValueError(\"Need both classes.\")\n",
    "if SMOKE:\n",
    "    train = small_group_sample(train, 12)\n",
    "    valid = small_group_sample(valid, 6)\n",
    "assert set(train.group).isdisjoint(set(valid.group))\n",
    "# Test rows are not loaded until hyperparameters have been frozen.\n",
    "display(pd.DataFrame(row_audit))\n",
    "display(pd.DataFrame([dict(split=n, rows=len(d), groups=d.group.nunique(),\n",
    "    block=int(d.y.sum()), allow=int((1-d.y).sum())) for n,d in [(\"train\",train),(\"validation\",valid)]]))\n",
    "print(\"Decision questions:\", QKEYS)"
   ],
   "id": "kev-cell-007"
  },
  {
   "cell_type": "code",
   "source": [
    "%pip uninstall -y torchaudio torchvision torchao"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "XoaH9MGdYjgs",
    "outputId": "9efc9424-5541-4b3a-fecc-bdf2793bf390"
   },
   "id": "XoaH9MGdYjgs",
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-008"
   },
   "source": [
    "### 4. Load the trained adapter + native decision head\n",
    "\n",
    "Kev’s checkpoint metadata pins its upstream Qwen revision when available. No quantization is used. On T4, the torso is cast to fp16; on supported GPUs it stays bf16. The small trained head stays fp32. Record this precision when comparing to published numbers.\n",
    "\n",
    "The native loader must be used: a generic Qwen `AutoModelForCausalLM` call would omit the trained decision adapter/head."
   ],
   "id": "kev-cell-008"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 249,
     "referenced_widgets": [
      "79f327f933a94474b2bfa198a5b5bc25",
      "19de258302b64122b20865a03f5ee26a",
      "7d2d8f8d53eb4554bcc007ff1278510a",
      "bd7b692726e3407481961f83b49f557f",
      "e5c570f15ad94ea196930038e774bed0",
      "e9334453baf8488fb1b2d365551864ea",
      "81b5f12c4ef94829a5d5d2c635ba3f17",
      "bb9296d06b17439eaf57b5a8fde48544",
      "49f952202314494e891a1c7e329ce536",
      "6ea0486ef2fc4ab1aee25040370ed8fe",
      "cbbfc464b57b4177a4721df86d3a72e4",
      "0b2618adc874422cb4c089cba2471fe8",
      "4ba51f107bb54c5e897243772a09217f",
      "1ce45780b61644b68d00cc2c767a4472",
      "68b77be0992849b0bda15f543b7c9cd3",
      "01b8d3757b4947d4855eb7d3a2f6fbb4",
      "3eb51e763592422490fc646b51828f39",
      "5d002110f2974dfba64cb23802f86687",
      "003cd52bd10f49f79b516dd56f9891b1",
      "0168cefdb7004712a722759e1f4b1143",
      "4f879afa4e55491f965b12b8427703f2",
      "7e1284a24eab4f5b953d0c013353b820",
      "acd9b9e6e696460ea61eca8fe3a6e44b",
      "ec05c655126e4ffd9ab41834119a00b3",
      "9ee7d6205ee44500a6380cb35cfb4e2f",
      "9680e8cdc5f7410384c7969e92177f95",
      "83bcda5812254f3ab4cb2ffceb4b7e07",
      "5311cfcdb71b42098a4fffa9b9deea42",
      "0b402b181ff54c79aafb9aca8848eddc",
      "bed9766d0c744b38a4738c1e71e76dd3",
      "f4bb5848ae8e42fab7ba563f43331c35",
      "6727bd74b51b44e394e2a8032900d1a7",
      "981e82a1a8bc481fbab9c6ae6c2c978c",
      "b67fd0ad28b0471fb15a7185bf9064db",
      "0712d0f5ac67401babcfa09813bc1b95",
      "c1490feefaf84e96a0605c1ec8dc62b3",
      "907882957414456ab42fd9117107a1ae",
      "7f46d30e99c24d48bad74f72f0fa6ea6",
      "7551376d6cd24a94ac6decda192db14e",
      "ed6a3d9256ac48d9a8816ff68fd9e54a",
      "1cf93431360d4555b4263a58289ecddf",
      "af7a9efee979475386d3d0f01f75e7a0",
      "e647dae40c004ceb92994c056d2dae68",
      "9825cb5f250f4a8cbac5cc6b945ee2fb"
     ]
    },
    "id": "kev-cell-009",
    "outputId": "f21d7cec-1d48-4b1b-e02c-bd64d2367200"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "DTYPE = torch.float16  # Half precision for your current GPU\n",
    "\n",
    "checkpoint = Checkpoint(f\"{MODEL_ID}@{MODEL_REV}\")\n",
    "\n",
    "# Complete adapter loading and precision conversion on CPU.\n",
    "tokenizer, model = checkpoint.load(\"cpu\", LoadOptions(\n",
    "    dtype=DTYPE, merge=False, backend=\"torch\", attn=\"eager\",\n",
    "    cuda_graphs=False, fused=False,\n",
    "))\n",
    "\n",
    "model.lm.to(dtype=DTYPE)\n",
    "model.head.to(dtype=torch.float32)\n",
    "\n",
    "# Transfer the finished model to GPU once.\n",
    "model.to(DEVICE)\n",
    "model.device = DEVICE\n",
    "model.requires_grad_(False)\n",
    "model.eval()\n",
    "\n",
    "print(\"GPU memory allocated:\",\n",
    "      round(torch.cuda.memory_allocated() / 2**30, 2), \"GiB\")\n",
    "# Keep the published LoRA unmerged, and leave the small decision head in fp32.\n",
    "base = model.lm.get_base_model() if hasattr(model.lm, \"get_base_model\") else model.lm\n",
    "layers = base.layers\n",
    "LAYERS = sorted(set(np.linspace(0, len(layers)-1, 7, dtype=int).tolist()))\n",
    "TRANSFER_LAYER = LAYERS[len(LAYERS)//2]\n",
    "MAX_STATE_TOKENS = 4096\n",
    "MAX_ROW_TOKENS = 4096\n",
    "print(\"Checkpoint:\", MODEL_ID, MODEL_REV)\n",
    "print(\"Base:\", checkpoint.meta.base, \"revision:\", checkpoint.meta.base_revision)\n",
    "print(\"Decoder blocks:\", len(layers), \"sampled blocks:\", LAYERS)\n",
    "print(\"Pointer-head temperature:\", model.head.temperature)\n",
    "print(\"LoRA merge / fused kernels / CUDA graphs: disabled for observable layer hooks.\")\n",
    "if checkpoint.meta.base_revision is None:\n",
    "    print(\"Upstream revision is unpinned; record this reproducibility limitation.\")"
   ],
   "id": "kev-cell-009"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-010"
   },
   "source": [
    "### 5. Read intermediate states during the native decision computation\n",
    "\n",
    "Like your notebook, this gets a vector from each chosen layer. The difference is **where**:\n",
    "- `answer_mean`: `<decide>` token, averaged over the frozen policy questions.\n",
    "- `option_delta`: closing marker of the true option minus that of the false option, averaged over questions.\n",
    "\n",
    "These pooled features are linear functions of the captured activations. The downstream MM / LR readouts are linear in them. We sample raw outputs of numbered decoder blocks, **before the final decoder normalization**; this is explicit and can differ from `outputs.hidden_states[-1]`.\n",
    "\n",
    "The native baseline is **max P(true) across the nine frozen decision questions**, with Kev’s saved head temperature. Kev uses its own state rendering, `<decide>` and closing-option markers. Each Qwen3.5 question runs as an independent causal row; the notebook preserves that native isolation. Hooks capture only requested positions and move small vectors to CPU. Prefix caching is disabled so each position belongs to a full prompt. One row is processed at a time; `QUESTION_BATCH` controls the question batch."
   ],
   "id": "kev-cell-010"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "kev-cell-011",
    "outputId": "f7557a6f-3406-4f2f-dafd-91e873f89294"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "FEATURES = (\"answer_mean\", \"option_delta\")\n",
    "\n",
    "def kev_record(state, variant=\"original\"):\n",
    "    if variant == \"json_reorder\":\n",
    "        state = dict(reversed(list(state.items())))\n",
    "    request = SystemOneRequest(state=state,\n",
    "        questions={k: QSET[\"questions\"][k] for k in QKEYS})\n",
    "    record, metadata = to_record(request)\n",
    "    if variant == \"option_reorder\":\n",
    "        # Change order while preserving the meaning of each option and its score mapping.\n",
    "        for q, m in zip(record[\"questions\"], metadata):\n",
    "            q[\"options\"] = list(reversed(q[\"options\"]))\n",
    "            m[\"keys\"] = list(reversed(m[\"keys\"]))\n",
    "    return record, metadata\n",
    "\n",
    "\n",
    "def predict_and_capture(state, requested_layers, variant=\"original\"):\n",
    "    record, metadata = kev_record(state, variant)\n",
    "    enc = model.encode(tokenizer, record, max_state=MAX_STATE_TOKENS,\n",
    "                       max_branch=MAX_ROW_TOKENS, strict=True)\n",
    "    assert not enc[\"state_truncated\"]\n",
    "    state_ids, state_pos, branches = rows_of(enc)\n",
    "    collected = {f: {l: [] for l in requested_layers} for f in FEATURES}\n",
    "    native_per_q, lengths = [], []\n",
    "    for start in range(0, len(branches), QUESTION_BATCH):\n",
    "        part = branches[start:start+QUESTION_BATCH]\n",
    "        meta = metadata[start:start+QUESTION_BATCH]\n",
    "        causal_rows = [(state_ids + r[\"ids\"], state_pos + r[\"pos\"]) for r in part]\n",
    "        ids, positions, mask = model._pad_rows(causal_rows)\n",
    "        bi = torch.arange(len(part), device=DEVICE)\n",
    "        decide = torch.tensor([len(state_ids)+r[\"decide\"] for r in part], device=DEVICE)\n",
    "        option_positions = [torch.tensor([len(state_ids)+o for o in r[\"opts\"]],\n",
    "                                       device=DEVICE) for r in part]\n",
    "        true_pos = torch.tensor([int(p[m[\"keys\"].index(\"true\")])\n",
    "                                 for p,m in zip(option_positions,meta)], device=DEVICE)\n",
    "        false_pos = torch.tensor([int(p[m[\"keys\"].index(\"false\")])\n",
    "                                  for p,m in zip(option_positions,meta)], device=DEVICE)\n",
    "        handles = []\n",
    "        def make_hook(layer_index):\n",
    "            def hook(_module, _inputs, output):\n",
    "                h = output[0] if isinstance(output,(tuple,list)) else output\n",
    "                assert h.ndim == 3 and h.shape[:2] == ids.shape\n",
    "                collected[\"answer_mean\"][layer_index].append(h[bi,decide].float().cpu().numpy())\n",
    "                collected[\"option_delta\"][layer_index].append(\n",
    "                    (h[bi,true_pos].float()-h[bi,false_pos].float()).cpu().numpy())\n",
    "            return hook\n",
    "        try:\n",
    "            for l in requested_layers:\n",
    "                handles.append(layers[l].register_forward_hook(make_hook(l)))\n",
    "            with torch.inference_mode():\n",
    "                hidden = model.lm(input_ids=ids, position_ids=positions,\n",
    "                    attention_mask=mask, use_cache=False).last_hidden_state.float()\n",
    "                for b,(opts,m) in enumerate(zip(option_positions,meta)):\n",
    "                    # model.head applies its saved calibration temperature in eval mode.\n",
    "                    logits = model.head(hidden[b,decide[b]],hidden[b,opts])\n",
    "                    probabilities = torch.softmax(logits.float(),dim=-1)\n",
    "                    native_per_q.append(float(probabilities[m[\"keys\"].index(\"true\")].cpu()))\n",
    "            lengths.extend(mask.sum(-1).cpu().tolist())\n",
    "        finally:\n",
    "            for handle in handles: handle.remove()\n",
    "    feats = {f: {l: np.concatenate(collected[f][l]).mean(axis=0)\n",
    "                 for l in requested_layers} for f in FEATURES}\n",
    "    assert len(native_per_q) == len(QKEYS)\n",
    "    assert all(np.isfinite(v).all() for by_layer in feats.values() for v in by_layer.values())\n",
    "    return feats, float(max(native_per_q)), native_per_q, max(lengths)\n",
    "\n",
    "# Compare the instrumented path with Kev's own native, uncached forward/readout.\n",
    "# Reduced-precision batch shapes can move probabilities slightly; this is a numerical check.\n",
    "first_state = train.iloc[0].state\n",
    "_, smoke_score, smoke_q, _ = predict_and_capture(first_state, LAYERS)\n",
    "record, metadata = kev_record(first_state)\n",
    "enc = model.encode(tokenizer, record, max_state=MAX_STATE_TOKENS,\n",
    "                   max_branch=MAX_ROW_TOKENS, strict=True)\n",
    "with torch.inference_mode():\n",
    "    reference_logits = model.forward(enc)\n",
    "reference_q = [float(torch.softmax(z.float(),-1)[m[\"keys\"].index(\"true\")].cpu())\n",
    "               for z,m in zip(reference_logits,metadata)]\n",
    "np.testing.assert_allclose(smoke_q,reference_q,atol=2e-2,rtol=0)\n",
    "print(\"Native-path numerical parity passed; max score:\",smoke_score)"
   ],
   "id": "kev-cell-011"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-012"
   },
   "source": [
    "### 6. Extract and cache dev activations\n",
    "\n",
    "Cache identity includes row IDs, state hashes, policy questions, model and code revisions, precision and sampled layers. Changing these invalidates the cache. Caches contain activations, not model weights. Oversize inputs raise an error rather than quietly changing the evaluation set."
   ],
   "id": "kev-cell-012"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 116,
     "referenced_widgets": [
      "8e8ff533e59d41f9b235c8709bae093a",
      "8acd8bd7b638490a9c2cc1046e8e75af",
      "0a0e65f045a943f19624888af28c019a",
      "37a27b6e988443909952ced610936333",
      "07b277ecd2d6426797097e745bf20f83",
      "9d036f77265a417b8cf0c03be110d007",
      "14492775e17546d08ccd1e8d06dfdd27",
      "3d76c47d8d064353a8c31050952eaf90",
      "906b0e587aa34c078884ce2e1eb48a45",
      "3e3e3bae2d8648288aa7973ab0e885f2",
      "b96c0c691d7e4111b0f51ae36845be29",
      "5e2d5ca9e6c743efa4e07983fdabd621",
      "9c9e5ad111c24946a717857cba127fda",
      "1da16b60c39649a8899674ea5cfb1539",
      "784274b9238e4a0480fa438f1a44ef6b",
      "a9737faaa36f4f04adacecf2ad936ee2",
      "69efa40d074445f582db620b8f987ad3",
      "a8b68867912b45cb8b27edd9c2f6d9ac",
      "250ff713275445368d9e0bd0a26c0e0e",
      "30e8e677d15746aaaafe75aa24c8671c",
      "ff2bf28332c9403ca69913042c58c6cb",
      "dd41ff378a9b405dbbbd06b87a9fc872"
     ]
    },
    "id": "kev-cell-013",
    "outputId": "dc2f0b8a-ab02-4c05-d2ed-fc0a7820e696"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "def extract_frame(df, name, requested_layers=LAYERS, variant=\"original\"):\n",
    "    identity = dict(ids=df.id.tolist(), hashes=df.state_hash.tolist(), questions=QSET,\n",
    "        model=MODEL_ID, model_rev=MODEL_REV, code_rev=KEV_CODE_REV,\n",
    "        benchmark_rev=BENCHMARK_REV, dtype=str(DTYPE), base_rev=checkpoint.meta.base_revision,\n",
    "        layers=requested_layers, variant=variant, question_batch=QUESTION_BATCH,\n",
    "        max_state_tokens=MAX_STATE_TOKENS,max_row_tokens=MAX_ROW_TOKENS,adapter_merged=False)\n",
    "    cache_key = hashlib.sha256(json.dumps(identity, sort_keys=True).encode()).hexdigest()[:16]\n",
    "    path = OUT / f\"{name}_{cache_key}.npz\"\n",
    "    if path.exists():\n",
    "        z = np.load(path)\n",
    "        return ({f: {l: z[f\"{f}_{l}\"] for l in requested_layers} for f in FEATURES},\n",
    "                z[\"native\"], z[\"per_question\"], z[\"tokens\"])\n",
    "    collected = {f: {l: [] for l in requested_layers} for f in FEATURES}\n",
    "    native, per_question, tokens = [], [], []\n",
    "    started = time.perf_counter()\n",
    "    for state in tqdm(df.state, desc=name):\n",
    "        feats, score, scores, length = predict_and_capture(state, requested_layers, variant)\n",
    "        for f in FEATURES:\n",
    "            for l in requested_layers:\n",
    "                collected[f][l].append(feats[f][l])\n",
    "        native.append(score); per_question.append(scores); tokens.append(length)\n",
    "    acts = {f: {l: np.stack(collected[f][l]) for l in requested_layers} for f in FEATURES}\n",
    "    payload = {f\"{f}_{l}\": acts[f][l] for f in FEATURES for l in requested_layers}\n",
    "    np.savez_compressed(path, **payload, native=np.array(native),\n",
    "        per_question=np.array(per_question), tokens=np.array(tokens))\n",
    "    path.with_suffix(\".json\").write_text(json.dumps(identity, indent=2))\n",
    "    print(f\"{name}: {len(df)} rows in {(time.perf_counter()-started)/60:.1f} minutes;\",\n",
    "          \"longest question sequence:\", max(tokens))\n",
    "    return acts, np.array(native), np.array(per_question), np.array(tokens)\n",
    "\n",
    "A_train, p_train_native, _, _ = extract_frame(train, \"train\")\n",
    "A_valid, p_valid_native, _, _ = extract_frame(valid, \"validation\")\n",
    "y_train, y_valid = train.y.to_numpy(), valid.y.to_numpy()"
   ],
   "id": "kev-cell-013"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-014"
   },
   "source": [
    "### 7. Train linear probes; select all settings on validation\n",
    "\n",
    "Difference-of-means uses your midpoint construction. Its score is a margin, not a calibrated probability. LR uses training-only standardization. Compare against native scores tuned on the same validation set and against a character n-gram text classifier trained on the same labels.\n",
    "\n",
    "A small search and modest dev split make this exploratory. If the validation curve is noisy, gather more independently labelled training data rather than repeatedly adjusting settings after seeing test."
   ],
   "id": "kev-cell-014"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 476
    },
    "id": "kev-cell-015",
    "outputId": "051267c7-1778-484b-87a7-d4e2747210f1"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "class MeanProbe:\n",
    "    def fit(self, X, y):\n",
    "        positive, negative = X[y==1].mean(0), X[y==0].mean(0)\n",
    "        self.direction = positive-negative\n",
    "        self.direction /= max(np.linalg.norm(self.direction), 1e-12)\n",
    "        self.midpoint = (positive+negative)/2\n",
    "        return self\n",
    "    def decision_function(self, X):\n",
    "        return (X-self.midpoint) @ self.direction\n",
    "\n",
    "\n",
    "def choose_threshold(y, scores, probability=False):\n",
    "    # Maximise validation balanced accuracy; include the meaningful default.\n",
    "    default = .5 if probability else 0.\n",
    "    candidates = np.unique(np.r_[np.quantile(scores, np.linspace(0,1,51)),\n",
    "        default, np.nextafter(float(np.max(scores)), np.inf)])\n",
    "    values = np.array([balanced_accuracy_score(y, scores >= t) for t in candidates])\n",
    "    tied = np.flatnonzero(values == values.max())\n",
    "    i = min(tied, key=lambda j: abs(candidates[j]-default))\n",
    "    return float(candidates[i]), float(values[i])\n",
    "\n",
    "search = []\n",
    "fitted = {}\n",
    "for feature in FEATURES:\n",
    "    for layer in LAYERS:\n",
    "        Xtr, Xva = A_train[feature][layer], A_valid[feature][layer]\n",
    "        candidates = [(\"MM\", None, MeanProbe().fit(Xtr, y_train))]\n",
    "        for C in [.001, .01, .1]:\n",
    "            lr = make_pipeline(StandardScaler(), LogisticRegression(\n",
    "                C=C, max_iter=2500, solver=\"liblinear\", random_state=SEED))\n",
    "            lr.fit(Xtr, y_train)\n",
    "            candidates.append((\"LR\", C, lr))\n",
    "        for kind, C, probe in candidates:\n",
    "            score = probe.decision_function(Xva)\n",
    "            threshold, ba = choose_threshold(y_valid, score)\n",
    "            key = (feature, layer, kind, C)\n",
    "            fitted[key] = probe\n",
    "            search.append(dict(feature=feature, layer=layer, kind=kind, C=C,\n",
    "                threshold=threshold, validation_BA=ba,\n",
    "                validation_AUROC=roc_auc_score(y_valid, score), key=key))\n",
    "search_df = pd.DataFrame(search)\n",
    "search_df.to_csv(OUT / \"validation_search.csv\", index=False)\n",
    "\n",
    "def select_best(kind):\n",
    "    return search_df[search_df.kind==kind].sort_values(\n",
    "        [\"validation_AUROC\", \"validation_BA\", \"layer\"], ascending=[False, False, True]).iloc[0]\n",
    "BEST = {kind: select_best(kind) for kind in [\"MM\",\"LR\"]}\n",
    "NATIVE_THRESHOLD, _ = choose_threshold(y_valid, p_valid_native, probability=True)\n",
    "TEXT_CANDIDATES = []\n",
    "for C in [.1, 1., 10.]:\n",
    "    clf = make_pipeline(TfidfVectorizer(analyzer=\"char\", ngram_range=(3,5),\n",
    "        min_df=1, max_features=20000), LogisticRegression(C=C, max_iter=2500,\n",
    "        solver=\"liblinear\", random_state=SEED))\n",
    "    clf.fit([r[\"text\"] for r in train.state], y_train)\n",
    "    vs = clf.predict_proba([r[\"text\"] for r in valid.state])[:,1]\n",
    "    threshold, ba = choose_threshold(y_valid, vs, probability=True)\n",
    "    TEXT_CANDIDATES.append((roc_auc_score(y_valid,vs), ba, C, threshold, clf))\n",
    "_, _, TEXT_C, TEXT_THRESHOLD, TEXT_MODEL = max(TEXT_CANDIDATES, key=lambda a:(a[0],a[1]))\n",
    "print(\"Frozen choices:\")\n",
    "for kind, choice in BEST.items():\n",
    "    print(kind, choice[[\"feature\",\"layer\",\"C\",\"threshold\",\"validation_AUROC\"]].to_dict())\n",
    "print(\"Native threshold:\", NATIVE_THRESHOLD, \"| text C / threshold:\", TEXT_C, TEXT_THRESHOLD)\n",
    "\n",
    "plt.figure(figsize=(9,4))\n",
    "for feature in FEATURES:\n",
    "    for kind in [\"MM\",\"LR\"]:\n",
    "        # LR curve shows its validation-selected C at each layer; diagnostic, not test results.\n",
    "        sub = search_df[(search_df.feature==feature)&(search_df.kind==kind)]\n",
    "        curve = sub.groupby(\"layer\").validation_AUROC.max()\n",
    "        plt.plot(curve.index, curve.values, marker=\"o\", label=f\"{kind}: {feature}\")\n",
    "plt.axhline(roc_auc_score(y_valid,p_valid_native), color=\"black\", ls=\"--\", label=\"Native score\")\n",
    "plt.axhline(.5,color=\"gray\",ls=\":\")\n",
    "plt.xlabel(\"Decoder block (zero-based)\"); plt.ylabel(\"Validation AUROC\")\n",
    "plt.title(\"Select the layer on validation, before test\"); plt.legend(fontsize=8)\n",
    "savefig(\"01_validation_layer_sweep\")"
   ],
   "id": "kev-cell-015"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-016"
   },
   "source": [
    "### 8. Freeze choices, then open test\n",
    "\n",
    "Native max-over-questions is not generally a calibrated probability of *any* policy violation. Its Brier score is a score diagnostic, not proof of calibration. MM and LR margins are evaluated with AUROC and selected decision thresholds; no probability-calibration claim is made for them."
   ],
   "id": "kev-cell-016"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 370,
     "referenced_widgets": [
      "32bb55546d974f78a50cf5695be88d8e",
      "70fedb77f8ae47fda55a16dce44b66f5",
      "3bba8f9a1d4f480d90ef6c097b0c4dd9",
      "111f61cb613449dca7a08eb1d94ed2b0",
      "09770b9b14ff41c98b021704dbf32146",
      "e5e7380b4982409eb699a2347e412ea6",
      "574e27cd78974629bca2ba938715f587",
      "8589c16affca4f648c3f6f8d4330c00a",
      "96576380db1a4c2a9d6d46ce5c16bf77",
      "ce906638acd14a40ab81760ed0a84f9f",
      "3c3a4776da4d492b98be7c1596c1470c"
     ]
    },
    "id": "kev-cell-017",
    "outputId": "a84e2a65-6bdd-49ae-e170-793268664c9e"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "frozen = {kind: {k: (None if isinstance(v, (float, np.floating)) and np.isnan(v)\n",
    "    else v.item() if isinstance(v, np.generic) else v)\n",
    "    for k,v in row.to_dict().items() if k != \"key\"} for kind,row in BEST.items()}\n",
    "(OUT / \"frozen_selection.json\").write_text(json.dumps(dict(probes=frozen,\n",
    "    native_threshold=NATIVE_THRESHOLD, text_C=TEXT_C, text_threshold=TEXT_THRESHOLD), indent=2))\n",
    "\n",
    "test = dedupe(load_rows(\"test\"))\n",
    "before = len(test)\n",
    "# Exclude any exact input or related group appearing anywhere in the dev split.\n",
    "test = test[~test.group.isin(dev.group) & ~test.state_hash.isin(dev.state_hash)].reset_index(drop=True)\n",
    "print(\"Excluded dev/test overlapping rows:\", before-len(test))\n",
    "if SMOKE:\n",
    "    test = small_group_sample(test, 12)\n",
    "assert test.y.nunique() == 2\n",
    "assert set(test.group).isdisjoint(set(dev.group))\n",
    "NEEDED_LAYERS = sorted({int(row.layer) for row in BEST.values()} | {TRANSFER_LAYER})\n",
    "A_test, p_test_native, q_test_native, test_tokens = extract_frame(test, \"test\", NEEDED_LAYERS)\n",
    "y_test = test.y.to_numpy()\n",
    "test_scores = {\"Native @0.5\": p_test_native, \"Native tuned\": p_test_native}\n",
    "thresholds = {\"Native @0.5\": .5, \"Native tuned\": NATIVE_THRESHOLD}\n",
    "for kind, choice in BEST.items():\n",
    "    test_scores[kind] = fitted[choice.key].decision_function(A_test[choice.feature][int(choice.layer)])\n",
    "    thresholds[kind] = float(choice.threshold)\n",
    "test_scores[\"Text n-gram\"] = TEXT_MODEL.predict_proba([r[\"text\"] for r in test.state])[:,1]\n",
    "thresholds[\"Text n-gram\"] = TEXT_THRESHOLD\n",
    "# Negative control: shuffle training labels, keep the selected LR layer/pooling/C fixed.\n",
    "lr_choice = BEST[\"LR\"]\n",
    "shuffled = make_pipeline(StandardScaler(), LogisticRegression(C=float(lr_choice.C),\n",
    "    max_iter=2500, solver=\"liblinear\", random_state=SEED))\n",
    "shuffled.fit(A_train[lr_choice.feature][int(lr_choice.layer)],\n",
    "             np.random.default_rng(SEED).permutation(y_train))\n",
    "test_scores[\"Shuffled-label LR\"] = shuffled.decision_function(A_test[lr_choice.feature][int(lr_choice.layer)])\n",
    "thresholds[\"Shuffled-label LR\"] = 0.\n",
    "# One shuffled run is a sanity check, not a full permutation significance test.\n",
    "\n",
    "def metric_values(y, scores, threshold):\n",
    "    pred = scores >= threshold\n",
    "    return dict(AUROC=roc_auc_score(y,scores), AP=average_precision_score(y,scores),\n",
    "        accuracy=accuracy_score(y,pred), balanced_accuracy=balanced_accuracy_score(y,pred),\n",
    "        catch_rate=float(pred[y==1].mean()), false_block_rate=float(pred[y==0].mean()))\n",
    "\n",
    "report = pd.DataFrame([dict(model=name, **metric_values(y_test,s,thresholds[name]))\n",
    "                       for name,s in test_scores.items()]).set_index(\"model\")\n",
    "display(report.round(3)); report.to_csv(OUT / \"test_metrics.csv\")\n",
    "print(\"Test rows:\",len(test),\"| groups:\",test.group.nunique(),\"| label prevalence:\",y_test.mean())\n",
    "print(\"These are local readable-topic results, not the published all-suite leaderboard.\")"
   ],
   "id": "kev-cell-017"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-018"
   },
   "source": [
    "### 9. Test graphs and uncertainty\n",
    "\n",
    "Bootstrap whole groups, preserving related safe / blocked pairs. The intervals condition on the already selected probe; they do not capture uncertainty from training-set sampling or the small validation search. Use the paired difference interval to assess evidence for an improvement over a tuned native score."
   ],
   "id": "kev-cell-018"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 1000
    },
    "id": "kev-cell-019",
    "outputId": "6397e6cf-f96e-40ba-ed74-02e24a56cd57"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "def group_bootstrap_indices(df, n_boot=N_BOOT):\n",
    "    rng = np.random.default_rng(SEED)\n",
    "    groups = df.group.unique()\n",
    "    indices = {g:np.flatnonzero(df.group.to_numpy()==g) for g in groups}\n",
    "    for _ in range(n_boot):\n",
    "        take = np.concatenate([indices[g] for g in rng.choice(groups,len(groups),replace=True)])\n",
    "        if df.y.iloc[take].nunique()==2:\n",
    "            yield take\n",
    "boot = list(group_bootstrap_indices(test))\n",
    "intervals = {}\n",
    "for name,s in test_scores.items():\n",
    "    samples = [balanced_accuracy_score(y_test[i],s[i]>=thresholds[name]) for i in boot]\n",
    "    intervals[name] = np.quantile(samples,[.025,.975])\n",
    "summary = report.copy()\n",
    "summary[\"BA_low\"] = [intervals[n][0] for n in summary.index]\n",
    "summary[\"BA_high\"] = [intervals[n][1] for n in summary.index]\n",
    "summary.to_csv(OUT / \"test_metrics_with_intervals.csv\")\n",
    "\n",
    "fig, axes = plt.subplots(1,2,figsize=(13,4.4))\n",
    "for name,s in test_scores.items():\n",
    "    if name==\"Native tuned\": continue  # Same ROC as the native default threshold.\n",
    "    fpr,tpr,_=roc_curve(y_test,s)\n",
    "    axes[0].plot(fpr,tpr,label=f\"{name}: {roc_auc_score(y_test,s):.3f}\")\n",
    "axes[0].plot([0,1],[0,1],\"k:\"); axes[0].set(xlabel=\"False-block rate\",ylabel=\"Catch rate\",title=\"Held-out ROC\")\n",
    "axes[0].legend(fontsize=8)\n",
    "names=list(summary.index); means=summary.balanced_accuracy.to_numpy()\n",
    "lo=np.array([intervals[n][0] for n in names]); hi=np.array([intervals[n][1] for n in names])\n",
    "# An empirical percentile interval can exclude its point estimate; draw endpoints directly.\n",
    "axes[1].barh(names,means,color=\"#457b9d\")\n",
    "axes[1].hlines(np.arange(len(names)),lo,hi,color=\"black\",linewidth=2)\n",
    "axes[1].scatter(means,np.arange(len(names)),color=\"white\",edgecolor=\"black\",zorder=3)\n",
    "axes[1].axvline(.5,color=\"gray\",ls=\":\"); axes[1].set(xlim=(0,1),xlabel=\"Balanced accuracy\",title=\"95% group-bootstrap intervals\")\n",
    "savefig(\"02_test_roc_and_accuracy\")\n",
    "\n",
    "fig, axes=plt.subplots(1,3,figsize=(12,3.8))\n",
    "for ax,name in zip(axes,[\"Native @0.5\",\"Native tuned\",\"LR\"]):\n",
    "    cm=confusion_matrix(y_test,test_scores[name]>=thresholds[name],labels=[0,1])\n",
    "    ax.imshow(cm,cmap=\"Blues\")\n",
    "    for i in range(2):\n",
    "        for j in range(2):ax.text(j,i,str(cm[i,j]),ha=\"center\",va=\"center\",fontsize=16)\n",
    "    ax.set(xticks=[0,1],yticks=[0,1],xticklabels=[\"Allow\",\"Block\"],yticklabels=[\"Allow\",\"Block\"],\n",
    "           xlabel=\"Prediction\",ylabel=\"Reference label\",title=name)\n",
    "savefig(\"03_test_confusion_matrices\")\n",
    "\n",
    "c=BEST[\"LR\"]; Xtr=A_train[c.feature][int(c.layer)]; Xte=A_test[c.feature][int(c.layer)]\n",
    "pca=PCA(n_components=2,svd_solver=\"randomized\",random_state=SEED).fit(Xtr)\n",
    "Z=pca.transform(Xte)\n",
    "plt.figure(figsize=(7,5))\n",
    "for label,color,text in [(0,\"#457b9d\",\"Allow\"),(1,\"#e76f51\",\"Block\")]:\n",
    "    ix=y_test==label; plt.scatter(Z[ix,0],Z[ix,1],c=color,s=20,alpha=.65,label=text)\n",
    "plt.xlabel(f\"PC1 ({pca.explained_variance_ratio_[0]:.1%} train variance)\")\n",
    "plt.ylabel(f\"PC2 ({pca.explained_variance_ratio_[1]:.1%} train variance)\")\n",
    "plt.title(f\"Test projection; PCA fitted on train only, block {int(c.layer)}\");plt.legend()\n",
    "savefig(\"04_train_fitted_pca\")\n",
    "# PCA separation alone is not the test of linear decodability; use the held-out probe metrics.\n",
    "\n",
    "differences={}\n",
    "for kind in [\"MM\",\"LR\"]:\n",
    "    ds=[balanced_accuracy_score(y_test[i],test_scores[kind][i]>=thresholds[kind])-\n",
    "        balanced_accuracy_score(y_test[i],p_test_native[i]>=NATIVE_THRESHOLD) for i in boot]\n",
    "    point=report.loc[kind,\"balanced_accuracy\"]-report.loc[\"Native tuned\",\"balanced_accuracy\"]\n",
    "    low,high=np.quantile(ds,[.025,.975])\n",
    "    differences[kind]=dict(BA_difference=float(point),low=float(low),high=float(high))\n",
    "display(pd.DataFrame(differences).T.round(3))\n",
    "(OUT/\"paired_probe_minus_tuned_native.json\").write_text(json.dumps(differences,indent=2))"
   ],
   "id": "kev-cell-019"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-020"
   },
   "source": [
    "### 10. Breakdown and example errors\n",
    "\n",
    "These tables can suggest failure modes, but do not use them to revise this run's probe or threshold. Any revision requires a new untouched test set. Labels in this suite were AI drafted and cross-checked; inspect ambiguous examples with the written policy before interpreting disagreement as a model failure."
   ],
   "id": "kev-cell-020"
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "kev-cell-021"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "topic_rows=[]\n",
    "for topic,sub in test.groupby(\"topic\"):\n",
    "    idx=sub.index.to_numpy(); y=y_test[idx]\n",
    "    if len(np.unique(y))<2:continue\n",
    "    for name in [\"Native @0.5\",\"Native tuned\",\"LR\",\"Text n-gram\"]:\n",
    "        topic_rows.append(dict(topic=topic,model=name,n=len(idx),\n",
    "            **metric_values(y,test_scores[name][idx],thresholds[name])))\n",
    "topic_metrics=pd.DataFrame(topic_rows)\n",
    "topic_metrics.to_csv(OUT/\"per_topic_metrics.csv\",index=False)\n",
    "if len(topic_metrics):\n",
    "    table=topic_metrics.pivot(index=\"topic\",columns=\"model\",values=\"balanced_accuracy\")\n",
    "    table.plot.barh(figsize=(10,6),xlim=(0,1));plt.xlabel(\"Balanced accuracy\")\n",
    "    plt.title(\"Same policy set; per-topic test examples\");savefig(\"05_per_topic_accuracy\")\n",
    "error_table=pd.DataFrame(dict(id=test.id,group=test.group,topic=test.topic,label=y_test,\n",
    "    native_score=p_test_native,lr_margin=test_scores[\"LR\"],\n",
    "    native_block=p_test_native>=.5,lr_block=test_scores[\"LR\"]>=thresholds[\"LR\"],\n",
    "    text=[s[\"text\"] for s in test.state]))\n",
    "error_table.to_csv(OUT/\"test_predictions.csv\",index=False)\n",
    "display(error_table[(error_table.native_block!=error_table.label)|\n",
    "                    (error_table.lr_block!=error_table.label)].head(10))"
   ],
   "id": "kev-cell-021"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-022"
   },
   "source": [
    "### 11. Optional stability tests (no refitting)\n",
    "\n",
    "Reverse JSON field order and reverse the two options while preserving their descriptions and true/false interpretation. Labels remain unchanged. The subset is chosen by seeded group sampling, not by errors. Both the native head and frozen LR probe see the modified inputs.\n",
    "\n",
    "A low flip rate is useful only alongside clean accuracy: a consistently wrong classifier is stable too. A probability change and a probe-margin change have different units. We plot decision flips and balanced accuracy, not a misleading shared score scale."
   ],
   "id": "kev-cell-022"
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "kev-cell-023"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "robust_rows=[]\n",
    "if RUN_ROBUSTNESS:\n",
    "    subset=small_group_sample(test,6 if SMOKE else 20)\n",
    "    original_positions=np.array([test.index[test.id==row_id][0] for row_id in subset.id])\n",
    "    c=BEST[\"LR\"]; layer=int(c.layer)\n",
    "    for variant in [\"json_reorder\",\"option_reorder\"]:\n",
    "        av,pv,_,_=extract_frame(subset,variant,[layer],variant)\n",
    "        lv=fitted[c.key].decision_function(av[c.feature][layer])\n",
    "        for name,changed in [(\"Native @0.5\",pv),(\"Native tuned\",pv),(\"LR\",lv)]:\n",
    "            original=test_scores[name][original_positions]\n",
    "            threshold=thresholds[name]\n",
    "            robust_rows.append(dict(variant=variant,model=name,n=len(subset),\n",
    "                flip_rate=float(np.mean((changed>=threshold)!=(original>=threshold))),\n",
    "                clean_BA=balanced_accuracy_score(subset.y,original>=threshold),\n",
    "                changed_BA=balanced_accuracy_score(subset.y,changed>=threshold),\n",
    "                mean_abs_score_change=float(np.mean(abs(changed-original)))))\n",
    "    robustness=pd.DataFrame(robust_rows)\n",
    "    display(robustness.round(3));robustness.to_csv(OUT/\"robustness.csv\",index=False)\n",
    "    fig,axes=plt.subplots(1,2,figsize=(12,4))\n",
    "    robustness.pivot(index=\"variant\",columns=\"model\",values=\"flip_rate\").plot.bar(ax=axes[0])\n",
    "    axes[0].set(ylabel=\"Decision flip fraction\",title=\"Semantic-preserving order changes\",ylim=(0,1))\n",
    "    robustness.pivot(index=\"variant\",columns=\"model\",values=\"changed_BA\").plot.bar(ax=axes[1])\n",
    "    axes[1].set(ylabel=\"Balanced accuracy after change\",title=\"Frozen thresholds and probes\",ylim=(0,1))\n",
    "    savefig(\"06_order_robustness\")"
   ],
   "id": "kev-cell-023"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-024"
   },
   "source": [
    "### 12. Optional transfer test: leave two topic families out of probe training\n",
    "\n",
    "This is predeclared, not chosen because a topic scored badly. Uses fixed answer-mean features, the midpoint sampled block, and C=0.01; these settings are not inherited from the earlier all-topic selection. Refits a probe with MedicalDiagnosis and LegalAdvice examples removed from training/validation, then evaluates them separately. All nine policies remain in the prompt. This measures transfer to **unseen example families under known policies**, not unseen policy definitions. The existing test set has already been viewed, so this is a secondary, exploratory analysis."
   ],
   "id": "kev-cell-024"
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "kev-cell-025"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "HELD_OUT_TOPICS={\"MedicalDiagnosis\",\"LegalAdvice\"}\n",
    "keep_train=~train.topic.isin(HELD_OUT_TOPICS).to_numpy()\n",
    "keep_valid=~valid.topic.isin(HELD_OUT_TOPICS).to_numpy()\n",
    "keep_test=test.topic.isin(HELD_OUT_TOPICS).to_numpy()\n",
    "transfer_rows=[]\n",
    "if all(len(np.unique(y))==2 for y in [y_train[keep_train],y_valid[keep_valid],\n",
    "                                    y_test[keep_test],y_test[~keep_test]]):\n",
    "    feature=\"answer_mean\"; layer=TRANSFER_LAYER\n",
    "    transfer=make_pipeline(StandardScaler(),LogisticRegression(C=.01,\n",
    "        max_iter=2500,solver=\"liblinear\",random_state=SEED))\n",
    "    transfer.fit(A_train[feature][layer][keep_train],y_train[keep_train])\n",
    "    vt=transfer.decision_function(A_valid[feature][layer][keep_valid])\n",
    "    tt,_=choose_threshold(y_valid[keep_valid],vt)\n",
    "    ts=transfer.decision_function(A_test[feature][layer])\n",
    "    nt,_=choose_threshold(y_valid[keep_valid],p_valid_native[keep_valid],probability=True)\n",
    "    for name,s,t in [(\"Transfer LR\",ts,tt),(\"Native tuned on seen topics\",p_test_native,nt)]:\n",
    "        for tag,mask in [(\"Seen topic families\",~keep_test),(\"Held-out topic families\",keep_test)]:\n",
    "            transfer_rows.append(dict(model=name,subset=tag,n=int(mask.sum()),\n",
    "                **metric_values(y_test[mask],s[mask],t)))\n",
    "    transfer_table=pd.DataFrame(transfer_rows)\n",
    "    display(transfer_table.round(3));transfer_table.to_csv(OUT/\"topic_transfer.csv\",index=False)\n",
    "    transfer_table.pivot(index=\"subset\",columns=\"model\",values=\"balanced_accuracy\").plot.bar(\n",
    "        figsize=(8,4),ylim=(0,1));plt.ylabel(\"Balanced accuracy\");plt.title(\"Exploratory topic-family transfer\")\n",
    "    savefig(\"07_topic_family_transfer\")\n",
    "else:\n",
    "    print(\"Transfer test skipped: this smoke subset lacks both labels in a required slice.\")"
   ],
   "id": "kev-cell-025"
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kev-cell-026"
   },
   "source": [
    "### 13. Export\n",
    "\n",
    "Download the ZIP before disconnecting Colab. It includes graphs, activation caches, settings and result tables. For another model, replace the loader, native rendering and position capture together; the analysis can be reused. Changing only `MODEL_ID` is not a valid cross-model experiment.\n",
    "\n",
    "**Interpretation:**\n",
    "- Probe beats native @0.5 but not native tuned: threshold choice may explain the gain.\n",
    "- Probe beats tuned native and text baseline, with a positive paired interval: evidence for useful learned readout information on this dataset.\n",
    "- Probe loses on held-out topic families or order changes: limited generalization / robustness.\n",
    "- High accuracy means information is decodable; it does **not** prove the model uses a specific feature causally, nor that its head alone caused its errors.\n",
    "\n",
    "To test the stronger claim that internal representations understand the policy while the head fails, add controlled policy changes, matched keyword controls, and activation interventions on independent data. Do not infer anything about closed Jev's internal states from another model's probes.\n",
    "\n",
    "A probe still requires the underlying forward pass. This experiment does not establish lower inference cost or a production-ready replacement for Bedrock Guardrails."
   ],
   "id": "kev-cell-026"
  },
  {
   "cell_type": "code",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 34
    },
    "id": "kev-cell-027",
    "outputId": "4d5578a3-ea24-486b-b931-3a5237e5c233"
   },
   "execution_count": null,
   "outputs": [],
   "source": [
    "manifest=dict(seed=SEED,smoke=SMOKE,model=MODEL_ID,model_revision=MODEL_REV,\n",
    "    base=checkpoint.meta.base,base_revision=checkpoint.meta.base_revision,\n",
    "    kev_code_revision=KEV_CODE_REV,benchmark_code_revision=BENCHMARK_REV,\n",
    "    data=DATA_ID,data_revision=DATA_REV,precision=str(DTYPE),\n",
    "    head_temperature=float(model.head.temperature),adapter_merged=False,\n",
    "    max_state_tokens=MAX_STATE_TOKENS,max_row_tokens=MAX_ROW_TOKENS,\n",
    "    gpu=torch.cuda.get_device_name(0),python=platform.python_version(),\n",
    "    question_keys=QKEYS,layers=LAYERS,question_batch=QUESTION_BATCH,\n",
    "    row_counts={\"train\":len(train),\"validation\":len(valid),\"test\":len(test)},\n",
    "    dataset_audit=row_audit,bootstrap=N_BOOT,\n",
    "    packages={p:im.version(p) for p in [\"torch\",\"transformers\",\"peft\",\"kev\",\n",
    "        \"scikit-learn\",\"huggingface-hub\",\"pandas\",\"numpy\",\"matplotlib\"]})\n",
    "(OUT/\"run_manifest.json\").write_text(json.dumps(manifest,indent=2))\n",
    "for name,df in [(\"train\",train),(\"validation\",valid),(\"test\",test)]:\n",
    "    df[[\"id\",\"group\",\"y\",\"topic\",\"source\",\"state_hash\"]].to_csv(OUT/f\"{name}_row_manifest.csv\",index=False)\n",
    "archive=OUT.with_suffix(\".zip\")\n",
    "with zipfile.ZipFile(archive,\"w\",compression=zipfile.ZIP_DEFLATED) as z:\n",
    "    for path in sorted(OUT.rglob(\"*\")):\n",
    "        if path.is_file():z.write(path,arcname=path.relative_to(OUT))\n",
    "print(\"Saved:\",archive)\n",
    "from google.colab import files\n",
    "files.download(str(archive))"
   ],
   "id": "kev-cell-027"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.12"
  },
  "colab": {
   "provenance": []
  },
  "accelerator": "GPU",
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "version_major": 2,
    "version_minor": 0,
    "state": {
     "79f327f933a94474b2bfa198a5b5bc25": {
      "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_19de258302b64122b20865a03f5ee26a",
        "IPY_MODEL_7d2d8f8d53eb4554bcc007ff1278510a",
        "IPY_MODEL_bd7b692726e3407481961f83b49f557f"
       ],
       "layout": "IPY_MODEL_e5c570f15ad94ea196930038e774bed0"
      }
     },
     "19de258302b64122b20865a03f5ee26a": {
      "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_e9334453baf8488fb1b2d365551864ea",
       "placeholder": "​",
       "style": "IPY_MODEL_81b5f12c4ef94829a5d5d2c635ba3f17",
       "value": "Download complete: "
      }
     },
     "7d2d8f8d53eb4554bcc007ff1278510a": {
      "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_bb9296d06b17439eaf57b5a8fde48544",
       "max": 1,
       "min": 0,
       "orientation": "horizontal",
       "style": "IPY_MODEL_49f952202314494e891a1c7e329ce536",
       "value": 0
      }
     },
     "bd7b692726e3407481961f83b49f557f": {
      "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_6ea0486ef2fc4ab1aee25040370ed8fe",
       "placeholder": "​",
       "style": "IPY_MODEL_cbbfc464b57b4177a4721df86d3a72e4",
       "value": "  0.00B            "
      }
     },
     "e5c570f15ad94ea196930038e774bed0": {
      "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
      }
     },
     "e9334453baf8488fb1b2d365551864ea": {
      "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
      }
     },
     "81b5f12c4ef94829a5d5d2c635ba3f17": {
      "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": ""
      }
     },
     "bb9296d06b17439eaf57b5a8fde48544": {
      "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": "20px"
      }
     },
     "49f952202314494e891a1c7e329ce536": {
      "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": ""
      }
     },
     "6ea0486ef2fc4ab1aee25040370ed8fe": {
      "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
      }
     },
     "cbbfc464b57b4177a4721df86d3a72e4": {
      "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": ""
      }
     },
     "0b2618adc874422cb4c089cba2471fe8": {
      "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_4ba51f107bb54c5e897243772a09217f",
        "IPY_MODEL_1ce45780b61644b68d00cc2c767a4472",
        "IPY_MODEL_68b77be0992849b0bda15f543b7c9cd3"
       ],
       "layout": "IPY_MODEL_01b8d3757b4947d4855eb7d3a2f6fbb4"
      }
     },
     "4ba51f107bb54c5e897243772a09217f": {
      "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_3eb51e763592422490fc646b51828f39",
       "placeholder": "​",
       "style": "IPY_MODEL_5d002110f2974dfba64cb23802f86687",
       "value": "Reconstruction complete: "
      }
     },
     "1ce45780b61644b68d00cc2c767a4472": {
      "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_003cd52bd10f49f79b516dd56f9891b1",
       "max": 1,
       "min": 0,
       "orientation": "horizontal",
       "style": "IPY_MODEL_0168cefdb7004712a722759e1f4b1143",
       "value": 0
      }
     },
     "68b77be0992849b0bda15f543b7c9cd3": {
      "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_4f879afa4e55491f965b12b8427703f2",
       "placeholder": "​",
       "style": "IPY_MODEL_7e1284a24eab4f5b953d0c013353b820",
       "value": "  0.00B /  0.00B            "
      }
     },
     "01b8d3757b4947d4855eb7d3a2f6fbb4": {
      "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
      }
     },
     "3eb51e763592422490fc646b51828f39": {
      "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
      }
     },
     "5d002110f2974dfba64cb23802f86687": {
      "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": ""
      }
     },
     "003cd52bd10f49f79b516dd56f9891b1": {
      "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": "20px"
      }
     },
     "0168cefdb7004712a722759e1f4b1143": {
      "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": ""
      }
     },
     "4f879afa4e55491f965b12b8427703f2": {
      "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
      }
     },
     "7e1284a24eab4f5b953d0c013353b820": {
      "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": ""
      }
     },
     "acd9b9e6e696460ea61eca8fe3a6e44b": {
      "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_ec05c655126e4ffd9ab41834119a00b3",
        "IPY_MODEL_9ee7d6205ee44500a6380cb35cfb4e2f",
        "IPY_MODEL_9680e8cdc5f7410384c7969e92177f95"
       ],
       "layout": "IPY_MODEL_83bcda5812254f3ab4cb2ffceb4b7e07"
      }
     },
     "ec05c655126e4ffd9ab41834119a00b3": {
      "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_5311cfcdb71b42098a4fffa9b9deea42",
       "placeholder": "​",
       "style": "IPY_MODEL_0b402b181ff54c79aafb9aca8848eddc",
       "value": "Fetching 13 files: 100%"
      }
     },
     "9ee7d6205ee44500a6380cb35cfb4e2f": {
      "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_bed9766d0c744b38a4738c1e71e76dd3",
       "max": 13,
       "min": 0,
       "orientation": "horizontal",
       "style": "IPY_MODEL_f4bb5848ae8e42fab7ba563f43331c35",
       "value": 13
      }
     },
     "9680e8cdc5f7410384c7969e92177f95": {
      "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_6727bd74b51b44e394e2a8032900d1a7",
       "placeholder": "​",
       "style": "IPY_MODEL_981e82a1a8bc481fbab9c6ae6c2c978c",
       "value": " 13/13 [00:00&lt;00:00, 158.59it/s]"
      }
     },
     "83bcda5812254f3ab4cb2ffceb4b7e07": {
      "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
      }
     },
     "5311cfcdb71b42098a4fffa9b9deea42": {
      "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
      }
     },
     "0b402b181ff54c79aafb9aca8848eddc": {
      "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": ""
      }
     },
     "bed9766d0c744b38a4738c1e71e76dd3": {
      "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
      }
     },
     "f4bb5848ae8e42fab7ba563f43331c35": {
      "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": ""
      }
     },
     "6727bd74b51b44e394e2a8032900d1a7": {
      "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
      }
     },
     "981e82a1a8bc481fbab9c6ae6c2c978c": {
      "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": ""
      }
     },
     "b67fd0ad28b0471fb15a7185bf9064db": {
      "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_0712d0f5ac67401babcfa09813bc1b95",
        "IPY_MODEL_c1490feefaf84e96a0605c1ec8dc62b3",
        "IPY_MODEL_907882957414456ab42fd9117107a1ae"
       ],
       "layout": "IPY_MODEL_7f46d30e99c24d48bad74f72f0fa6ea6"
      }
     },
     "0712d0f5ac67401babcfa09813bc1b95": {
      "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_7551376d6cd24a94ac6decda192db14e",
       "placeholder": "​",
       "style": "IPY_MODEL_ed6a3d9256ac48d9a8816ff68fd9e54a",
       "value": "Loading weights: 100%"
      }
     },
     "c1490feefaf84e96a0605c1ec8dc62b3": {
      "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_1cf93431360d4555b4263a58289ecddf",
       "max": 426,
       "min": 0,
       "orientation": "horizontal",
       "style": "IPY_MODEL_af7a9efee979475386d3d0f01f75e7a0",
       "value": 426
      }
     },
     "907882957414456ab42fd9117107a1ae": {
      "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_e647dae40c004ceb92994c056d2dae68",
       "placeholder": "​",
       "style": "IPY_MODEL_9825cb5f250f4a8cbac5cc6b945ee2fb",
       "value": " 426/426 [01:01&lt;00:00,  7.67it/s]"
      }
     },
     "7f46d30e99c24d48bad74f72f0fa6ea6": {
      "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
      }
     },
     "7551376d6cd24a94ac6decda192db14e": {
      "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
      }
     },
     "ed6a3d9256ac48d9a8816ff68fd9e54a": {
      "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": ""
      }
     },
     "1cf93431360d4555b4263a58289ecddf": {
      "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
      }
     },
     "af7a9efee979475386d3d0f01f75e7a0": {
      "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": ""
      }
     },
     "e647dae40c004ceb92994c056d2dae68": {
      "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
      }
     },
     "9825cb5f250f4a8cbac5cc6b945ee2fb": {
      "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": ""
      }
     },
     "8e8ff533e59d41f9b235c8709bae093a": {
      "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_8acd8bd7b638490a9c2cc1046e8e75af",
        "IPY_MODEL_0a0e65f045a943f19624888af28c019a",
        "IPY_MODEL_37a27b6e988443909952ced610936333"
       ],
       "layout": "IPY_MODEL_07b277ecd2d6426797097e745bf20f83"
      }
     },
     "8acd8bd7b638490a9c2cc1046e8e75af": {
      "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_9d036f77265a417b8cf0c03be110d007",
       "placeholder": "​",
       "style": "IPY_MODEL_14492775e17546d08ccd1e8d06dfdd27",
       "value": "train: 100%"
      }
     },
     "0a0e65f045a943f19624888af28c019a": {
      "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_3d76c47d8d064353a8c31050952eaf90",
       "max": 89,
       "min": 0,
       "orientation": "horizontal",
       "style": "IPY_MODEL_906b0e587aa34c078884ce2e1eb48a45",
       "value": 89
      }
     },
     "37a27b6e988443909952ced610936333": {
      "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_3e3e3bae2d8648288aa7973ab0e885f2",
       "placeholder": "​",
       "style": "IPY_MODEL_b96c0c691d7e4111b0f51ae36845be29",
       "value": " 89/89 [03:09&lt;00:00,  1.56s/it]"
      }
     },
     "07b277ecd2d6426797097e745bf20f83": {
      "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
      }
     },
     "9d036f77265a417b8cf0c03be110d007": {
      "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
      }
     },
     "14492775e17546d08ccd1e8d06dfdd27": {
      "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": ""
      }
     },
     "3d76c47d8d064353a8c31050952eaf90": {
      "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
      }
     },
     "906b0e587aa34c078884ce2e1eb48a45": {
      "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": ""
      }
     },
     "3e3e3bae2d8648288aa7973ab0e885f2": {
      "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
      }
     },
     "b96c0c691d7e4111b0f51ae36845be29": {
      "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": ""
      }
     },
     "5e2d5ca9e6c743efa4e07983fdabd621": {
      "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_9c9e5ad111c24946a717857cba127fda",
        "IPY_MODEL_1da16b60c39649a8899674ea5cfb1539",
        "IPY_MODEL_784274b9238e4a0480fa438f1a44ef6b"
       ],
       "layout": "IPY_MODEL_a9737faaa36f4f04adacecf2ad936ee2"
      }
     },
     "9c9e5ad111c24946a717857cba127fda": {
      "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_69efa40d074445f582db620b8f987ad3",
       "placeholder": "​",
       "style": "IPY_MODEL_a8b68867912b45cb8b27edd9c2f6d9ac",
       "value": "validation: 100%"
      }
     },
     "1da16b60c39649a8899674ea5cfb1539": {
      "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_250ff713275445368d9e0bd0a26c0e0e",
       "max": 29,
       "min": 0,
       "orientation": "horizontal",
       "style": "IPY_MODEL_30e8e677d15746aaaafe75aa24c8671c",
       "value": 29
      }
     },
     "784274b9238e4a0480fa438f1a44ef6b": {
      "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_ff2bf28332c9403ca69913042c58c6cb",
       "placeholder": "​",
       "style": "IPY_MODEL_dd41ff378a9b405dbbbd06b87a9fc872",
       "value": " 29/29 [00:43&lt;00:00,  1.67s/it]"
      }
     },
     "a9737faaa36f4f04adacecf2ad936ee2": {
      "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
      }
     },
     "69efa40d074445f582db620b8f987ad3": {
      "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
      }
     },
     "a8b68867912b45cb8b27edd9c2f6d9ac": {
      "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": ""
      }
     },
     "250ff713275445368d9e0bd0a26c0e0e": {
      "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
      }
     },
     "30e8e677d15746aaaafe75aa24c8671c": {
      "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": ""
      }
     },
     "ff2bf28332c9403ca69913042c58c6cb": {
      "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
      }
     },
     "dd41ff378a9b405dbbbd06b87a9fc872": {
      "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": ""
      }
     },
     "32bb55546d974f78a50cf5695be88d8e": {
      "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_70fedb77f8ae47fda55a16dce44b66f5",
        "IPY_MODEL_3bba8f9a1d4f480d90ef6c097b0c4dd9",
        "IPY_MODEL_111f61cb613449dca7a08eb1d94ed2b0"
       ],
       "layout": "IPY_MODEL_09770b9b14ff41c98b021704dbf32146"
      }
     },
     "70fedb77f8ae47fda55a16dce44b66f5": {
      "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_e5e7380b4982409eb699a2347e412ea6",
       "placeholder": "​",
       "style": "IPY_MODEL_574e27cd78974629bca2ba938715f587",
       "value": "test: 100%"
      }
     },
     "3bba8f9a1d4f480d90ef6c097b0c4dd9": {
      "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_8589c16affca4f648c3f6f8d4330c00a",
       "max": 540,
       "min": 0,
       "orientation": "horizontal",
       "style": "IPY_MODEL_96576380db1a4c2a9d6d46ce5c16bf77",
       "value": 540
      }
     },
     "111f61cb613449dca7a08eb1d94ed2b0": {
      "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_ce906638acd14a40ab81760ed0a84f9f",
       "placeholder": "​",
       "style": "IPY_MODEL_3c3a4776da4d492b98be7c1596c1470c",
       "value": " 540/540 [12:41&lt;00:00,  1.41s/it]"
      }
     },
     "09770b9b14ff41c98b021704dbf32146": {
      "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
      }
     },
     "e5e7380b4982409eb699a2347e412ea6": {
      "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
      }
     },
     "574e27cd78974629bca2ba938715f587": {
      "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": ""
      }
     },
     "8589c16affca4f648c3f6f8d4330c00a": {
      "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
      }
     },
     "96576380db1a4c2a9d6d46ce5c16bf77": {
      "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": ""
      }
     },
     "ce906638acd14a40ab81760ed0a84f9f": {
      "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
      }
     },
     "3c3a4776da4d492b98be7c1596c1470c": {
      "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": 5
}
