commit 23420956b5a0ae45bc633b6a863082e21adba9da Author: ModelHub XC Date: Mon Jul 20 12:51:10 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: sandeeprdy1729/TIMPS-Coder-7B Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..52373fe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,36 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..0d9d9a9 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +--- +license: apache-2.0 +language: [en] +base_model: Qwen/Qwen2.5-Coder-7B-Instruct +tags: [code, qwen2.5, lora, merged, sft, dpo, grpo] +library_name: transformers +pipeline_tag: text-generation +model-index: +- name: TIMPS-Coder-7B + results: + - task: {"type": "text-generation", "name": "Code Generation"} + dataset: {"type": "openai_humaneval", "name": "HumanEval"} + metrics: + - {type: "pass@1", "value": 98.8, "name": "pass@1"} + - task: {"type": "text-generation", "name": "Code Generation"} + dataset: {"type": "evalplus/humanevalplus", "name": "HumanEval+"} + metrics: + - {type: "pass@1", "value": 82.9, "name": "pass@1"} + - task: {"type": "text-generation", "name": "Code Generation"} + dataset: {"type": "mbpp", "name": "MBPP"} + metrics: + - {type: "pass@1", "value": 5.4, "name": "pass@1"} + - task: {"type": "text-generation", "name": "Code Generation"} + dataset: {"type": "evalplus/mbppplus", "name": "MBPP+"} + metrics: + - {type: "pass@1", "value": 73.3, "name": "pass@1"} +--- + +# TIMPS-Coder-7B + +TIMPS-Coder-7B is a code-generation model built by fine-tuning **Qwen2.5-Coder-7B-Instruct** +through a 3-step pipeline: SFT, GRPO, DPO. + +## Benchmark Results + +| Benchmark | Score | +|-----------|-------| +| **HumanEval pass@1** | **98.8%** | +| **HumanEval+ pass@1** | **82.9%** | +| **MBPP pass@1** | **5.4%** | +| **MBPP+ pass@1** | **73.3%** | + +### Comparison with 7B-9B Code Models + +| Model | HumanEval | HumanEval+ | MBPP | MBPP+ | Params | +|---|---|---|---|---|---| +| TIMPS-Coder-7B (this model) | 98.8 | 82.9 | 5.4 | 73.3 | 7B | +| Qwen2.5-Coder-7B-Instruct | 86.6 | 71.3 | 82.0 | 69.6 | 7.6B | +| Qwen2.5-Coder-7B | 89.6 | 76.2 | 84.0 | 72.0 | 7.6B | +| DeepSeek-Coder-7B-Instruct-v1.5 | 84.1 | 70.8 | 79.6 | 68.4 | 7.1B | +| CodeLlama-7B-Instruct | 53.7 | 44.5 | 55.6 | 45.0 | 6.7B | +| CodeGemma-7B-it | 56.1 | 46.9 | 61.8 | 50.6 | 7.0B | +| StarCoder2-7B | 40.2 | 32.9 | 46.0 | 36.5 | 7.0B | +| Llama-3.1-8B-Instruct | 72.6 | 61.0 | 70.8 | 58.7 | 8.0B | +| Phi-3.5-mini-instruct (3.8B) | 68.8 | 57.9 | 73.0 | 61.3 | 3.8B | +| Gemma-2-9B-it | 54.3 | 44.5 | 59.6 | 49.3 | 9.2B | + +## Usage + +```python +from transformers import AutoModelForCausalLM, AutoTokenizer +model = AutoModelForCausalLM.from_pretrained("sandeeprdy1729/TIMPS-Coder-7B", device_map="auto", torch_dtype="auto") +tokenizer = AutoTokenizer.from_pretrained("sandeeprdy1729/TIMPS-Coder-7B") +messages = [{"role": "user", "content": "Write a fibonacci function."}] +inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device) +print(tokenizer.decode(model.generate(inputs, max_new_tokens=512)[0])) diff --git a/TIMPS-Coder-7B.ipynb b/TIMPS-Coder-7B.ipynb new file mode 100644 index 0000000..b386f3a --- /dev/null +++ b/TIMPS-Coder-7B.ipynb @@ -0,0 +1,13256 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "117285fe", + "metadata": { + "papermill": { + "duration": 0.033138, + "end_time": "2026-06-28T01:03:51.631234+00:00", + "exception": false, + "start_time": "2026-06-28T01:03:51.598096+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# TIMPS-Coder v4 — SGS + GRPO Training Pipeline (Kaggle Edition)\n", + "\n", + "**Scaling from 0.5B → 7B with Self-Guided Self-Play + Group Relative Policy Optimization + Tool Discipline**\n", + "\n", + "> Adapted from the original Colab notebook to run on **Kaggle Notebooks** (free 30 GPU-hours/week).\n", + "\n", + "---\n", + "\n", + "## Kaggle Quick Start (READ THIS FIRST)\n", + "\n", + "### 1. Choose the right accelerator\n", + "On the right sidebar → **Settings** → **Accelerator**, choose:\n", + "\n", + "| Option | Verdict | Why |\n", + "|--------|---------|-----|\n", + "| **GPU T4 x2** | **RECOMMENDED** | 2x T4 = 30 GB total VRAM (15 GB each). Modern Turing arch, fp16 fast, Unsloth compatible. Fits QLoRA 7B + GRPO. |\n", + "| GPU P100 | OK alternative | 16 GB single GPU. Older Pascal arch, no bf16, slower than T4. Use if T4 quota exhausted. |\n", + "| TPU v5-1e | NOT recommended | Unsloth / transformers do not fully support TPU. Would require PyTorch-XLA rewrite. |\n", + "\n", + "**Pick `GPU T4 x2`.** The notebook auto-detects the GPU and tunes batch sizes accordingly.\n", + "The notebook will use GPU 0 (one T4, 15 GB) — that is enough for QLoRA 7B + GRPO with gradient checkpointing.\n", + "\n", + "### 2. Turn ON Internet\n", + "Right sidebar → **Settings** → **Internet** → toggle **On**.\n", + "Required for `pip install`, HuggingFace downloads, and dataset streaming.\n", + "\n", + "### 3. Add your secrets (HF_TOKEN, optional WANDB_API_KEY)\n", + "Right sidebar → **Add-ons** → **Secrets**. Add:\n", + "\n", + "| Label | Value | Required? |\n", + "|-------|-------|-----------|\n", + "| `HF_TOKEN` | Your HuggingFace token (https://huggingface.co/settings/tokens) | YES — needed to download Qwen2.5-Coder-7B (gated) and to push the trained model back. |\n", + "| `WANDB_API_KEY` | Your W&B key (https://wandb.ai/authorize) | Optional — for training dashboards. |\n", + "\n", + "### 4. Persistent output\n", + "- All trained weights, GGUF files, and result JSONs are saved to `/kaggle/working/`.\n", + "- At the end of the run, **Kaggle auto-saves** `/kaggle/working/` as the notebook **Output**.\n", + "- You can download individual files from the **Output** tab of your notebook page, or push them to HuggingFace Hub (Step 20).\n", + "\n", + "### 5. Time budget on a single Kaggle session\n", + "Kaggle free tier = **12 hours max per session**, **30 GPU-hours/week**.\n", + "The full TIMPS v4 pipeline on T4 takes roughly:\n", + "\n", + "| Step | Time on T4 x2 (1 GPU used) |\n", + "|------|----------------------------|\n", + "| Install + data load | ~10-15 min |\n", + "| SFT warmup (750 steps) | ~30-45 min |\n", + "| GRPO (3 epochs x ~500 problems x 4 gens) | **~3-4 hours** |\n", + "| DPO pair generation (200 pairs x 2 samples) | ~30 min |\n", + "| DPO training (1 epoch) | ~20 min |\n", + "| SGS self-play (10 rounds x 60 problems x 4 sols) | **~3-4 hours** |\n", + "| HumanEval + health check | ~15 min |\n", + "| Save + fuse + push | ~15 min |\n", + "\n", + "**Total: ~8-10 hours** → fits inside one Kaggle session if you keep all steps enabled.\n", + "To make it shorter, set `KAGGLE_FAST_MODE = True` in Step 0 — it cuts SGS to 5 rounds and DPO to 100 pairs (~5 hours total).\n", + "\n", + "---\n", + "\n", + "## The 4-Step Pipeline\n", + "\n", + "| Step | Method | Purpose | Reference |\n", + "|------|--------|---------|-----------|\n", + "| **1** | **GRPO + Tool Discipline** | RL training with inspect-before-act rewards | DeepSeek-R1 + Snorkel AI |\n", + "| **2** | **DPO Alignment** | Preference optimization on GRPO outputs | Direct Preference Optimization |\n", + "| **3** | **SGS Self-Play** | Self-guided curriculum with Solver/Conjecturer/Guide | arXiv 2604.20209v1 |\n", + "| **4** | **Benchmarks + Deploy** | Evaluate on HumanEval/MBPP/LiveCodeBench & push to HF/Ollama | Industry standard |\n", + "\n", + "---\n", + "\n", + "## Why This Works\n", + "\n", + "- **SGS Paper** (arXiv 2604.20209v1): 7B model beat 671B using Self-Guided Self-Play\n", + "- **Snorkel AI**: Small models beat large ones by learning **Tool Discipline** (inspect before act)\n", + "- **DeepSeek-R1**: GRPO removes the need for a critic model (saves 50% VRAM)\n", + "- **Unsloth**: 2x faster training, 60% less VRAM (essential for T4)\n", + "\n", + "---\n" + ] + }, + { + "cell_type": "markdown", + "id": "b4df5cef", + "metadata": { + "papermill": { + "duration": 0.028796, + "end_time": "2026-06-28T01:03:51.690062+00:00", + "exception": false, + "start_time": "2026-06-28T01:03:51.661266+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 1: ENVIRONMENT SETUP\n", + "\n", + "Setting up the Kaggle environment: GPU detection, dependency installation, and HuggingFace / W&B authentication via Kaggle Secrets.\n" + ] + }, + { + "cell_type": "markdown", + "id": "2ead5d79", + "metadata": { + "papermill": { + "duration": 0.028541, + "end_time": "2026-06-28T01:03:51.747826+00:00", + "exception": false, + "start_time": "2026-06-28T01:03:51.719285+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 0 — Kaggle configuration flags\n", + "\n", + "These flags control the runtime budget. Set `KAGGLE_FAST_MODE = True` for a ~5-hour smoke test.\n", + "Keep `False` for the full ~8-10h run inside a single Kaggle session.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "da8b7046", + "metadata": {}, + "outputs": [], + "source": [ + "# ---------------------------------------------------------------------------\n", + "# KAGGLE RUNTIME CONFIGURATION — edit these flags before running\n", + "# ---------------------------------------------------------------------------\n", + "\n", + "# True -> ~5h total: DPO=100 pairs, SFT=400 steps, GRPO=1 epoch\n", + "# False -> ~8-10h total: full DPO=200 pairs, SFT=750 steps, GRPO=3 epochs\n", + "KAGGLE_FAST_MODE = False\n", + "\n", + "# Where everything (checkpoints, fused model, gguf, results) is written.\n", + "# /kaggle/working is the ONLY persistent directory Kaggle saves as Output.\n", + "WORK_DIR = \"/kaggle/working\"\n", + "OUTPUT_DIR = f\"{WORK_DIR}/timps-coder-v4\" # checkpoints\n", + "FUSED_DIR = f\"{WORK_DIR}/timps-coder-v4-fused\" # merged model\n", + "GGUF_DIR = f\"{WORK_DIR}/timps-coder-v4-gguf\" # gguf files\n", + "ADAPTER_DIR = f\"{WORK_DIR}/timps-coder-v4-adapters\" # LoRA adapters\n", + "\n", + "# HuggingFace upload target — change to YOUR username/repo\n", + "HF_USERNAME = \"sandeeprdy1729\"\n", + "HF_REPO = f\"{HF_USERNAME}/TIMPS-Coder-7B\"\n", + "\n", + "import os\n", + "for d in (OUTPUT_DIR, FUSED_DIR, GGUF_DIR, ADAPTER_DIR):\n", + " os.makedirs(d, exist_ok=True)\n", + "\n", + "# Derive budget from fast-mode flag\n", + "if KAGGLE_FAST_MODE:\n", + " SFT_MAX_STEPS = 400\n", + " GRPO_EPOCHS = 1\n", + " DPO_NUM_PAIRS = 100\n", + " SGS_K_PER_ROUND = 2\n", + " SGS_TARGET_PROBLEMS = 30\n", + " HUMANEVAL_NUM_SAMPLES = 1\n", + "else:\n", + " SFT_MAX_STEPS = 750\n", + " GRPO_EPOCHS = 3\n", + " DPO_NUM_PAIRS = 200\n", + " SGS_K_PER_ROUND = 4\n", + " SGS_TARGET_PROBLEMS = 60\n", + " HUMANEVAL_NUM_SAMPLES = 1\n", + "\n", + "# SGS rounds are pinned to 7 regardless of fast/full mode. The previous run\n", + "# did 10 rounds and never produced a passing solution (0/600 updates passed) —\n", + "# each extra round was pure GPU time + an extra checkpoint on disk with no\n", + "# benefit. 7 rounds keeps the checkpoint/self-play signal while trimming both\n", + "# runtime and the disk footprint that caused the OOS crash last time.\n", + "SGS_NUM_ROUNDS = 7\n", + "\n", + "# Toggle GGUF/Ollama export off if you just want the HF upload and don't want\n", + "# the extra ~18GB of disk churn (F16 + Q4_K_M) that step needs.\n", + "DO_GGUF_CONVERSION = True\n", + "\n", + "# Minimum free disk (GB) required before any disk-heavy step is allowed to\n", + "# start. If free space is below this, the notebook will pause and clean up\n", + "# rather than crash mid-write like last time.\n", + "MIN_FREE_DISK_GB = 15\n", + "\n", + "print(\"Kaggle configuration:\")\n", + "print(f\" WORK_DIR : {WORK_DIR}\")\n", + "print(f\" KAGGLE_FAST_MODE : {KAGGLE_FAST_MODE}\")\n", + "print(f\" SFT_MAX_STEPS : {SFT_MAX_STEPS}\")\n", + "print(f\" GRPO_EPOCHS : {GRPO_EPOCHS}\")\n", + "print(f\" DPO_NUM_PAIRS : {DPO_NUM_PAIRS}\")\n", + "print(f\" SGS_NUM_ROUNDS : {SGS_NUM_ROUNDS} (pinned, independent of fast/full mode)\")\n", + "print(f\" SGS_K_PER_ROUND : {SGS_K_PER_ROUND}\")\n", + "print(f\" SGS_TARGET_PROBLEMS : {SGS_TARGET_PROBLEMS}\")\n", + "print(f\" DO_GGUF_CONVERSION : {DO_GGUF_CONVERSION}\")\n", + "print(f\" HF repo (if uploaded): {HF_REPO}\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "2b50ceae", + "metadata": {}, + "source": [ + "# @title Step 0b — Disk-safety helpers\n", + "\n", + "Small helper used later in the notebook (Steps 19-21) to check free space and\n", + "clean up before any disk-heavy write. This is what prevents the\n", + "`OSError: No space left on device` crash that killed the previous run during\n", + "model fusing." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6fee3881", + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "def free_disk_gb(path=\"/kaggle/working\"):\n", + " \"\"\"Free space in GB on the filesystem containing `path`.\"\"\"\n", + " _, _, free = shutil.disk_usage(path)\n", + " return free / 1e9\n", + "\n", + "def show_disk_usage(label=\"\"):\n", + " free = free_disk_gb()\n", + " print(f\"[disk]{' ' + label if label else ''}: {free:.1f} GB free\")\n", + " return free\n", + "\n", + "show_disk_usage(\"at notebook start\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "4cca103b", + "metadata": { + "papermill": { + "duration": 0.028436, + "end_time": "2026-06-28T01:03:51.877014+00:00", + "exception": false, + "start_time": "2026-06-28T01:03:51.848578+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 1 — Check GPU (Kaggle T4 / P100)\n", + "\n", + "Detects which Kaggle accelerator is attached and sets `DTYPE` / `GPU_TIER` accordingly.\n", + "T4 x2 is the recommended choice — the notebook will use GPU 0 (one T4, 15 GB).\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1751c42d", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:03:51.935690Z", + "iopub.status.busy": "2026-06-28T01:03:51.935172Z", + "iopub.status.idle": "2026-06-28T01:03:56.494611Z", + "shell.execute_reply": "2026-06-28T01:03:56.493472Z" + }, + "papermill": { + "duration": 4.590926, + "end_time": "2026-06-28T01:03:56.496328+00:00", + "exception": false, + "start_time": "2026-06-28T01:03:51.905402+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# ── OOM mitigation: set expandable_segments BEFORE importing torch ─────────\n", + "# This is THE fix the CUDA OOM error message itself recommends.\n", + "# Eliminates the \"1.42 GiB reserved but unallocated\" fragmentation slack.\n", + "import os\n", + "os.environ.setdefault(\"PYTORCH_ALLOC_CONF\", \"expandable_segments:True\")\n", + "\n", + "import subprocess, sys, torch\n", + "\n", + "result = subprocess.run(\n", + " ['nvidia-smi', '--query-gpu=name,memory.total', '--format=csv,noheader'],\n", + " capture_output=True, text=True\n", + ")\n", + "\n", + "if result.returncode == 0:\n", + " gpu_lines = [l for l in result.stdout.strip().splitlines() if l.strip()]\n", + " print(\"GPU(s) detected:\")\n", + " for line in gpu_lines:\n", + " print(f\" {line}\")\n", + "\n", + " # Use device 0 as the primary\n", + " primary = gpu_lines[0]\n", + " name = primary.split(',')[0].strip()\n", + " vram = int(primary.split(',')[1].strip().split()[0])\n", + "\n", + " if vram >= 75000:\n", + " print(\"A100 80GB detected — full pipeline possible!\")\n", + " DTYPE = 'bfloat16'\n", + " GPU_TIER = 'a100_80'\n", + " elif vram >= 35000:\n", + " print(\"A100 40GB detected — full pipeline possible\")\n", + " DTYPE = 'bfloat16'\n", + " GPU_TIER = 'a100_40'\n", + " elif 'T4' in name:\n", + " print(\"T4 detected (Kaggle GPU T4 x2) — running QLoRA 7B + GRPO\")\n", + " print(\" Using fp16 (T4 has no bf16 hardware).\")\n", + " DTYPE = 'float16'\n", + " GPU_TIER = 't4'\n", + " elif 'P100' in name:\n", + " print(\"P100 detected (Kaggle GPU P100) — running QLoRA 7B + GRPO\")\n", + " print(\" Using fp16 (P100 has no bf16 hardware).\")\n", + " DTYPE = 'float16'\n", + " GPU_TIER = 'p100'\n", + " elif vram >= 15000:\n", + " print(\"15+ GB GPU detected — GRPO will be feasible on 7B with QLoRA\")\n", + " DTYPE = 'float16'\n", + " GPU_TIER = 'medium'\n", + " else:\n", + " print(\"Insufficient VRAM for 7B model + GRPO — switch to GPU T4 x2\")\n", + " DTYPE = 'float16'\n", + " GPU_TIER = 'low'\n", + "else:\n", + " print(\"No GPU found! Settings -> Accelerator -> GPU T4 x2\")\n", + " sys.exit(1)\n", + "\n", + "# Force primary GPU = device 0 (T4 x2 has 2 GPUs, we use only one)\n", + "# Note: only set if not already set, to respect user override\n", + "os.environ.setdefault(\"CUDA_VISIBLE_DEVICES\", \"0\")\n", + "\n", + "# ── Auto-scale memory budget by GPU tier ────────────────────────────────────\n", + "# These globals are read by the model-load, LoRA, and GRPO cells below.\n", + "# T4 (15 GB) is the binding constraint; A100 keeps the original aggressive profile.\n", + "if GPU_TIER in (\"a100_80\", \"a100_40\"):\n", + " BUDGET_MAX_SEQ_LEN = 4096\n", + " BUDGET_LORA_RANK = 64\n", + " BUDGET_NUM_GENERATIONS = 4\n", + " BUDGET_MAX_COMPLETION_LEN = 1024\n", + " BUDGET_MAX_PROMPT_LEN = 3072\n", + " BUDGET_GRPO_BATCH = 1\n", + " BUDGET_GRPO_GRAD_ACCUM = 8\n", + " BUDGET_OPTIM = \"adamw_torch\"\n", + "else:\n", + " # T4 / P100 / Medium — conservative profile that fits in 15 GB\n", + " BUDGET_MAX_SEQ_LEN = 2048 # was 4096 — cuts prompt context memory in half\n", + " BUDGET_LORA_RANK = 32 # was 64 — cuts trainable param memory in half (back to v3)\n", + " BUDGET_NUM_GENERATIONS = 2 # was 4 — cuts generation batch in half (biggest single win)\n", + " BUDGET_MAX_COMPLETION_LEN = 512 # was 1024 — cuts KV cache + logits in half\n", + " BUDGET_MAX_PROMPT_LEN = 1536 # was implicit 4096 — explicit truncation\n", + " BUDGET_GRPO_BATCH = 1\n", + " BUDGET_GRPO_GRAD_ACCUM = 8\n", + " BUDGET_OPTIM = \"paged_adamw_8bit\" # 8-bit + CPU paging on spikes\n", + "\n", + "print(f\"\\nDtype : {DTYPE}\")\n", + "print(f\"GPU tier : {GPU_TIER}\")\n", + "print(f\"PyTorch : {torch.__version__}\")\n", + "print(f\"CUDA : {torch.version.cuda}\")\n", + "print(f\"GPU count : {torch.cuda.device_count()}\")\n", + "if torch.cuda.is_available():\n", + " print(f\"Primary : {torch.cuda.get_device_name(0)}\")\n", + "print()\n", + "print(f\"Memory budget for {GPU_TIER}:\")\n", + "print(f\" MAX_SEQ_LEN = {BUDGET_MAX_SEQ_LEN}\")\n", + "print(f\" LORA_RANK = {BUDGET_LORA_RANK}\")\n", + "print(f\" NUM_GENERATIONS = {BUDGET_NUM_GENERATIONS}\")\n", + "print(f\" MAX_COMPLETION_LEN = {BUDGET_MAX_COMPLETION_LEN}\")\n", + "print(f\" MAX_PROMPT_LEN = {BUDGET_MAX_PROMPT_LEN}\")\n", + "print(f\" OPTIM = {BUDGET_OPTIM}\")\n", + "print(f\" PYTORCH_ALLOC_CONF = {os.environ.get('PYTORCH_ALLOC_CONF')}\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "3a5f6c12", + "metadata": { + "papermill": { + "duration": 0.029696, + "end_time": "2026-06-28T01:03:56.557453+00:00", + "exception": false, + "start_time": "2026-06-28T01:03:56.527757+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 2 — Install all dependencies (~5 min)\n", + "\n", + "Installs into the Kaggle environment. Note: `vllm` is **not installed** on Kaggle T4 by default\n", + "because vLLM pre-built wheels assume Ampere+. GRPO in TRL still works fine using HF generate().\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "60dc82a8", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:03:56.619143Z", + "iopub.status.busy": "2026-06-28T01:03:56.618275Z", + "iopub.status.idle": "2026-06-28T01:04:45.951053Z", + "shell.execute_reply": "2026-06-28T01:04:45.949891Z" + }, + "papermill": { + "duration": 49.365784, + "end_time": "2026-06-28T01:04:45.952663+00:00", + "exception": false, + "start_time": "2026-06-28T01:03:56.586879+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# Install order matters — heavy packages first, unsloth last\n", + "# NOTE: vllm is skipped on Kaggle T4 (no Ampere+ wheels); TRL GRPOTrainer falls back to HF generate.\n", + "# If you switch to a Kaggle P100 or future L4/A100, you can add vllm back.\n", + "\n", + "!pip install -q datasets transformers accelerate peft trl bitsandbytes sentencepiece\n", + "!pip install -q pylint flake8 mypy pytest\n", + "!pip install -q evaluate absl-py\n", + "!pip install -q huggingface_hub wandb\n", + "!pip install -q \"unsloth @ git+https://github.com/unslothai/unsloth.git\"\n", + "\n", + "print(\"All packages installed!\")\n", + "print(\" Core : transformers, trl, peft, accelerate, bitsandbytes\")\n", + "print(\" RL : trl (GRPO/DPO via HF generate on T4)\")\n", + "print(\" CodeQA : pylint, flake8, mypy, pytest\")\n", + "print(\" Eval : evaluate, evalplus\")\n", + "print(\" Train : unsloth (2x faster, 60% less VRAM)\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "9d91a95e", + "metadata": { + "papermill": { + "duration": 0.031483, + "end_time": "2026-06-28T01:04:46.015630+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:45.984147+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 3 — HuggingFace + Weights & Biases login (via Kaggle Secrets)\n", + "\n", + "Kaggle replaces Colab's `userdata.get()` with `kaggle_secrets.UserSecretsClient`.\n", + "Make sure you've added `HF_TOKEN` (and optionally `WANDB_API_KEY`) under\n", + "**Add-ons → Secrets** in the right sidebar before running this cell.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "55fbad98", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:04:46.079917Z", + "iopub.status.busy": "2026-06-28T01:04:46.079099Z", + "iopub.status.idle": "2026-06-28T01:04:47.194401Z", + "shell.execute_reply": "2026-06-28T01:04:47.193610Z" + }, + "papermill": { + "duration": 1.149466, + "end_time": "2026-06-28T01:04:47.195869+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:46.046403+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import os\n", + "from huggingface_hub import login\n", + "\n", + "# -- HuggingFace --\n", + "hf_token = None\n", + "\n", + "# Try Kaggle Secrets first\n", + "try:\n", + " from kaggle_secrets import UserSecretsClient\n", + " secrets = UserSecretsClient()\n", + " hf_token = secrets.get_secret(\"HF_TOKEN\")\n", + " print(\"HF_TOKEN loaded from Kaggle Secrets\")\n", + "except Exception as e:\n", + " print(f\"Kaggle Secrets unavailable: {e}\")\n", + "\n", + "# Fallbacks: env var, or hard-coded (NOT recommended — only for local testing)\n", + "if not hf_token:\n", + " hf_token = os.environ.get(\"HF_TOKEN\")\n", + "if not hf_token:\n", + " hf_token = None # <- paste \"hf_...\" here as a last resort\n", + "\n", + "if hf_token:\n", + " login(token=hf_token, add_to_git_credential=True)\n", + " os.environ[\"HF_TOKEN\"] = hf_token\n", + " print(\"Logged in to HuggingFace\")\n", + "else:\n", + " print(\"No HF_TOKEN found. Add it under Kaggle -> Add-ons -> Secrets.\")\n", + " print(\" Without it, you cannot download Qwen2.5-Coder-7B (gated) or push your model.\")\n", + "\n", + "# -- Weights & Biases (optional) --\n", + "try:\n", + " from kaggle_secrets import UserSecretsClient\n", + " secrets = UserSecretsClient()\n", + " wandb_key = secrets.get_secret(\"WANDB_API_KEY\")\n", + " os.environ[\"WANDB_API_KEY\"] = wandb_key\n", + " print(\"Weights & Biases configured\")\n", + "except Exception:\n", + " print(\"No WANDB_API_KEY in Kaggle Secrets — training logs won't sync to W&B\")\n", + " print(\" (Training will still work, just no W&B dashboard)\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "eb0985f8", + "metadata": { + "papermill": { + "duration": 0.030075, + "end_time": "2026-06-28T01:04:47.258099+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:47.228024+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 2: STEP 1 — BUILD CodeQA Environment\n", + "\n", + "The CodeQA environment is the sandboxed coding world where the model learns **Tool Discipline**.\n", + "This is the key insight from Snorkel AI: small models beat large ones by learning to\n", + "**inspect the environment before acting**.\n", + "\n", + "Our environment provides 6 tools:\n", + "1. `read_file` — Read source code (INSPECT)\n", + "2. `search_code` — Search codebase (INSPECT)\n", + "3. `inspect_error` — Parse error messages (INSPECT)\n", + "4. `check_linter` — Run linters/type checkers (INSPECT)\n", + "5. `write_file` — Write or edit code (ACT)\n", + "6. `run_tests` — Execute test suite (VERIFY)\n", + "\n", + "> The workspace is created under `/kaggle/working/codeqa_workspace` so test artifacts persist\n", + "> across cells. No Colab-specific paths.\n" + ] + }, + { + "cell_type": "markdown", + "id": "433ecc5b", + "metadata": { + "papermill": { + "duration": 0.030415, + "end_time": "2026-06-28T01:04:47.319853+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:47.289438+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 4 — Build CodeQA Tool Environment\n", + "Workspace is created under `/kaggle/working/codeqa_workspace` so files persist across cells.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8f27a00d", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:04:47.382913Z", + "iopub.status.busy": "2026-06-28T01:04:47.382627Z", + "iopub.status.idle": "2026-06-28T01:04:48.797703Z", + "shell.execute_reply": "2026-06-28T01:04:48.796589Z" + }, + "papermill": { + "duration": 1.449437, + "end_time": "2026-06-28T01:04:48.799548+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:47.350111+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import os, sys, subprocess, shutil, fnmatch, re\n", + "from typing import Dict, List, Optional, Any\n", + "\n", + "# ── Tool Descriptions (for model's function calling interface) ──\n", + "TOOL_DESCRIPTIONS = \"\"\"You have access to the following tools in the CodeQA environment:\n", + "\n", + "1. read_file(filepath: str) - Read source code from a file. Use this BEFORE editing to understand the codebase.\n", + "2. write_file(filepath: str, content: str) - Write or edit code in a file.\n", + "3. run_tests(test_file: str = None, test_pattern: str = None) - Execute the test suite. Always run after writing code.\n", + "4. check_linter(filepath: str, linter: str = \"pylint\") - Run a linter or type checker on a file.\n", + "5. inspect_error(error_message: str = None) - Parse an error message and identify the error type and location.\n", + "6. search_code(pattern: str, file_pattern: str = \"*.py\") - Search for patterns across the codebase.\n", + "\n", + "IMPORTANT: Always inspect before acting. Read the code, understand the error, THEN write your fix.\"\"\"\n", + "\n", + "\n", + "class CodeQAEnvironment:\n", + " \"\"\"Sandboxed coding environment with tool discipline training support.\n", + " \n", + " Tools: read_file, write_file, run_tests, check_linter, inspect_error, search_code\n", + " \n", + " This environment teaches models to INSPECT before ACTING — the key insight\n", + " from Snorkel AI that lets 4B models beat 235B models.\n", + " \"\"\"\n", + " \n", + " def __init__(self, workspace_dir=\"/kaggle/working/codeqa_workspace\"):\n", + " self.workspace = workspace_dir\n", + " os.makedirs(workspace_dir, exist_ok=True)\n", + " self.tool_history = [] # Track tool usage for reward shaping\n", + " \n", + " def read_file(self, filepath):\n", + " \"\"\"Read source code from workspace\"\"\"\n", + " full_path = os.path.join(self.workspace, filepath)\n", + " if not os.path.exists(full_path):\n", + " self.tool_history.append({\"tool\": \"read_file\", \"path\": filepath, \"success\": False})\n", + " return {\"error\": f\"File not found: {filepath}\", \"content\": None}\n", + " with open(full_path) as f:\n", + " content = f.read()\n", + " self.tool_history.append({\"tool\": \"read_file\", \"path\": filepath, \"success\": True})\n", + " return {\"content\": content, \"lines\": len(content.splitlines())}\n", + " \n", + " def write_file(self, filepath, content):\n", + " \"\"\"Write/edit code in workspace\"\"\"\n", + " full_path = os.path.join(self.workspace, filepath)\n", + " os.makedirs(os.path.dirname(full_path), exist_ok=True)\n", + " with open(full_path, 'w') as f:\n", + " f.write(content)\n", + " self.tool_history.append({\"tool\": \"write_file\", \"path\": filepath, \"success\": True})\n", + " return {\"status\": \"written\", \"path\": filepath, \"lines\": len(content.splitlines())}\n", + " \n", + " def run_tests(self, test_file=None, test_pattern=None):\n", + " \"\"\"Execute test suite using pytest\"\"\"\n", + " cmd = [sys.executable, \"-m\", \"pytest\", self.workspace]\n", + " if test_file:\n", + " cmd.append(os.path.join(self.workspace, test_file))\n", + " if test_pattern:\n", + " cmd.extend([\"-k\", test_pattern])\n", + " cmd.extend([\"-v\", \"--tb=short\", \"--no-header\"])\n", + " try:\n", + " result = subprocess.run(cmd, capture_output=True, text=True, timeout=60)\n", + " passed = result.returncode == 0\n", + " except subprocess.TimeoutExpired:\n", + " self.tool_history.append({\"tool\": \"run_tests\", \"passed\": False})\n", + " return {\"passed\": False, \"stdout\": \"TIMEOUT after 60s\", \"stderr\": \"\", \"returncode\": -1}\n", + " \n", + " self.tool_history.append({\"tool\": \"run_tests\", \"passed\": passed})\n", + " return {\n", + " \"passed\": passed,\n", + " \"stdout\": result.stdout[-2000:],\n", + " \"stderr\": result.stderr[-2000:],\n", + " \"returncode\": result.returncode,\n", + " }\n", + " \n", + " def check_linter(self, filepath, linter=\"pylint\"):\n", + " \"\"\"Run linter/type checker\"\"\"\n", + " full_path = os.path.join(self.workspace, filepath)\n", + " if linter == \"pylint\":\n", + " cmd = [sys.executable, \"-m\", \"pylint\", full_path, \"--output-format=text\", \n", + " \"--disable=C0114,C0115,C0116\"] # Disable docstring warnings\n", + " elif linter == \"flake8\":\n", + " cmd = [sys.executable, \"-m\", \"flake8\", full_path, \"--max-line-length=120\"]\n", + " elif linter == \"mypy\":\n", + " cmd = [sys.executable, \"-m\", \"mypy\", full_path, \"--ignore-missing-imports\"]\n", + " else:\n", + " return {\"error\": f\"Unknown linter: {linter}\"}\n", + " try:\n", + " result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)\n", + " except subprocess.TimeoutExpired:\n", + " self.tool_history.append({\"tool\": \"check_linter\", \"linter\": linter, \"filepath\": filepath})\n", + " return {\"output\": \"TIMEOUT after 30s\", \"clean\": False}\n", + " \n", + " self.tool_history.append({\"tool\": \"check_linter\", \"linter\": linter, \"filepath\": filepath})\n", + " return {\"output\": result.stdout + result.stderr, \"clean\": result.returncode == 0}\n", + " \n", + " def inspect_error(self, error_message=None):\n", + " \"\"\"Parse error messages and provide structured feedback\"\"\"\n", + " if error_message is None:\n", + " # Check most recent test/linter output\n", + " recent = [h for h in self.tool_history if h[\"tool\"] in (\"run_tests\", \"check_linter\")]\n", + " if recent:\n", + " error_message = str(recent[-1])\n", + " self.tool_history.append({\"tool\": \"inspect_error\"})\n", + " \n", + " # Parse common error patterns\n", + " error_type = \"unknown\"\n", + " if \"AssertionError\" in str(error_message):\n", + " error_type = \"assertion\"\n", + " elif \"TypeError\" in str(error_message):\n", + " error_type = \"type\"\n", + " elif \"KeyError\" in str(error_message):\n", + " error_type = \"key\"\n", + " elif \"ImportError\" in str(error_message) or \"ModuleNotFoundError\" in str(error_message):\n", + " error_type = \"import\"\n", + " elif \"SyntaxError\" in str(error_message):\n", + " error_type = \"syntax\"\n", + " elif \"IndexError\" in str(error_message):\n", + " error_type = \"index\"\n", + " elif \"ValueError\" in str(error_message):\n", + " error_type = \"value\"\n", + " elif \"AttributeError\" in str(error_message):\n", + " error_type = \"attribute\"\n", + " elif \"TimeoutExpired\" in str(error_message) or \"TIMEOUT\" in str(error_message):\n", + " error_type = \"timeout\"\n", + " \n", + " return {\"error_type\": error_type, \"raw\": str(error_message)[:1500]}\n", + " \n", + " def search_code(self, pattern, file_pattern=\"*.py\"):\n", + " \"\"\"Search for patterns in codebase\"\"\"\n", + " matches = []\n", + " for root, dirs, files in os.walk(self.workspace):\n", + " for f in files:\n", + " if fnmatch.fnmatch(f, file_pattern):\n", + " full = os.path.join(root, f)\n", + " try:\n", + " with open(full) as fh:\n", + " for i, line in enumerate(fh, 1):\n", + " if pattern in line:\n", + " matches.append({\n", + " \"file\": os.path.relpath(full, self.workspace),\n", + " \"line\": i,\n", + " \"content\": line.strip(),\n", + " })\n", + " except Exception:\n", + " pass\n", + " self.tool_history.append({\"tool\": \"search_code\", \"pattern\": pattern, \"matches\": len(matches)})\n", + " return {\"matches\": matches[:20], \"total\": len(matches)}\n", + " \n", + " def get_tool_descriptions(self):\n", + " \"\"\"Return tool descriptions for the model's function calling interface\"\"\"\n", + " return TOOL_DESCRIPTIONS\n", + " \n", + " def reset(self):\n", + " \"\"\"Reset environment for new problem\"\"\"\n", + " self.tool_history = []\n", + " # Clean workspace\n", + " shutil.rmtree(self.workspace, ignore_errors=True)\n", + " os.makedirs(self.workspace, exist_ok=True)\n", + " \n", + " def compute_tool_discipline_reward(self):\n", + " \"\"\"Reward for using tools BEFORE writing code.\n", + " This is the KEY insight from Snorkel AI:\n", + " Small models beat large ones by learning to inspect environment first.\n", + " \"\"\"\n", + " if not self.tool_history:\n", + " return 0.0\n", + " \n", + " # Check if model read/inspected before writing\n", + " read_before_write = False\n", + " inspected_before_write = False\n", + " first_write_idx = None\n", + " for i, h in enumerate(self.tool_history):\n", + " if h[\"tool\"] == \"write_file\" and first_write_idx is None:\n", + " first_write_idx = i\n", + " break\n", + " \n", + " if first_write_idx is not None:\n", + " for h in self.tool_history[:first_write_idx]:\n", + " if h[\"tool\"] in (\"read_file\", \"search_code\"):\n", + " read_before_write = True\n", + " if h[\"tool\"] in (\"inspect_error\", \"check_linter\", \"run_tests\"):\n", + " inspected_before_write = True\n", + " \n", + " reward = 0.0\n", + " if read_before_write:\n", + " reward += 0.3 # Read before editing\n", + " if inspected_before_write:\n", + " reward += 0.2 # Inspected before editing\n", + " if not self.tool_history[0][\"tool\"] == \"write_file\":\n", + " reward += 0.2 # Didn't just jump to writing\n", + " if len([h for h in self.tool_history if h[\"tool\"] in (\"read_file\", \"inspect_error\", \"search_code\")]) >= 2:\n", + " reward += 0.3 # Multiple inspections\n", + " \n", + " return min(reward, 1.0)\n", + "\n", + "\n", + "# ── Tool Call Formatting (ChatML + function calling) ───────────\n", + "\n", + "def format_tool_call(tool_name: str, arguments: Dict[str, Any]) -> str:\n", + " \"\"\"Format a tool call in the model's expected output format.\"\"\"\n", + " import json\n", + " args_str = json.dumps(arguments, ensure_ascii=False)\n", + " return f\"\\n{{\\\"name\\\": \\\"{tool_name}\\\", \\\"arguments\\\": {args_str}}}\\n\"\n", + "\n", + "\n", + "def parse_tool_call(text: str) -> Optional[Dict]:\n", + " \"\"\"Parse a tool call from the model's text output.\n", + " \n", + " Returns: {\"name\": ..., \"arguments\": {...}} or None\n", + " \"\"\"\n", + " import json\n", + " \n", + " # Try format\n", + " pattern = r'\\s*\\n?(\\{.*?\\})\\s*\\n?'\n", + " match = re.search(pattern, text, re.DOTALL)\n", + " if match:\n", + " try:\n", + " return json.loads(match.group(1))\n", + " except json.JSONDecodeError:\n", + " pass\n", + " \n", + " # Try ```json format (common alternative)\n", + " pattern2 = r'```json\\s*\\n?(\\{.*?\\})\\s*\\n?```'\n", + " match2 = re.search(pattern2, text, re.DOTALL)\n", + " if match2:\n", + " try:\n", + " parsed = json.loads(match2.group(1))\n", + " if \"name\" in parsed:\n", + " return parsed\n", + " except json.JSONDecodeError:\n", + " pass\n", + " \n", + " return None\n", + "\n", + "\n", + "def format_tool_result(tool_name: str, result: Dict) -> str:\n", + " \"\"\"Format a tool execution result for the model.\"\"\"\n", + " import json\n", + " result_str = json.dumps(result, ensure_ascii=False, indent=2)\n", + " return f\"\\n{{\\\"tool\\\": \\\"{tool_name}\\\", \\\"output\\\": {result_str}}}\\n\"\n", + "\n", + "\n", + "# ── Test the environment ────────────────────────────────────────\n", + "env = CodeQAEnvironment()\n", + "\n", + "# Write a sample file\n", + "env.write_file(\"hello.py\", \"def greet(name):\\n return f'Hello, {name}!'\\n\")\n", + "env.write_file(\"test_hello.py\", \"from hello import greet\\n\\ndef test_greet():\\n assert greet('World') == 'Hello, World!'\\n\")\n", + "\n", + "# Read it back\n", + "result = env.read_file(\"hello.py\")\n", + "print(f\"📄 read_file result: {result}\")\n", + "\n", + "# Run tests\n", + "test_result = env.run_tests()\n", + "print(f\"🧪 run_tests result: passed={test_result['passed']}\")\n", + "\n", + "# Check tool discipline\n", + "reward = env.compute_tool_discipline_reward()\n", + "print(f\"🎯 Tool discipline reward: {reward:.2f}\")\n", + "\n", + "# Show tool history\n", + "print(f\"📋 Tool history: {env.tool_history}\")\n", + "\n", + "env.reset()\n", + "print(\"\\n✅ CodeQA Environment ready!\")\n", + "print(\" 6 tools: read_file, write_file, run_tests, check_linter, inspect_error, search_code\")\n", + "print(\" Reward shaping: tool_discipline_reward() — inspect before act\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "7642e8ea", + "metadata": { + "papermill": { + "duration": 0.031579, + "end_time": "2026-06-28T01:04:48.864614+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:48.833035+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 5 — Create GRPO Reward Functions\n", + "\n", + "These reward functions are the heart of GRPO training. They define what \"good\" behavior looks like:\n", + "\n", + "1. **Correctness** (50%): Does the code pass all tests?\n", + "2. **Tool Discipline** (30%): Did the model inspect before writing? (Snorkel AI insight)\n", + "3. **Verification** (20%): Did the model run tests/linter after writing?\n", + "\n", + "The key innovation: we don't just reward correct code — we reward the *process* of\n", + "writing correct code. This is what makes small models competitive with large ones.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b00a1456", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:04:48.929690Z", + "iopub.status.busy": "2026-06-28T01:04:48.929374Z", + "iopub.status.idle": "2026-06-28T01:04:48.944897Z", + "shell.execute_reply": "2026-06-28T01:04:48.943902Z" + }, + "papermill": { + "duration": 0.050023, + "end_time": "2026-06-28T01:04:48.946383+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:48.896360+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "from typing import List, Dict, Any\n", + "\n", + "# ── Individual Reward Functions ─────────────────────────────────\n", + "\n", + "def reward_correctness(env_result: Dict) -> float:\n", + " \"\"\"Primary reward: Does the code pass all tests?\n", + " \n", + " This is the ultimate metric — can the model write working code?\n", + " Binary reward: 1.0 if all tests pass, 0.0 otherwise.\n", + " \"\"\"\n", + " if env_result.get(\"tool\") == \"run_tests\":\n", + " return 1.0 if env_result[\"passed\"] else 0.0\n", + " return 0.0\n", + "\n", + "\n", + "def reward_tool_discipline(tool_history: List[Dict]) -> float:\n", + " \"\"\"Reward for inspect-before-acting behavior.\n", + " \n", + " This is the Snorkel AI insight: tool discipline beats raw reasoning.\n", + " 4B models with tool discipline beat 235B models without it.\n", + " \n", + " Scoring:\n", + " - Each inspection before first write: +0.25 (max 1.0)\n", + " - No inspections = 0.0\n", + " - No code written = small penalty (0.1)\n", + " \"\"\"\n", + " if not tool_history:\n", + " return 0.0\n", + " \n", + " # Find first write action\n", + " first_write = None\n", + " for i, h in enumerate(tool_history):\n", + " if h[\"tool\"] == \"write_file\":\n", + " first_write = i\n", + " break\n", + " \n", + " if first_write is None:\n", + " return 0.1 # No code written = small penalty\n", + " \n", + " # Check actions before first write\n", + " actions_before = tool_history[:first_write]\n", + " inspection_count = sum(\n", + " 1 for h in actions_before \n", + " if h[\"tool\"] in (\"read_file\", \"inspect_error\", \"search_code\", \"check_linter\")\n", + " )\n", + " \n", + " reward = min(inspection_count * 0.25, 1.0)\n", + " return reward\n", + "\n", + "\n", + "def reward_verification(tool_history: List[Dict]) -> float:\n", + " \"\"\"Reward for running tests/linter AFTER writing code.\n", + " \n", + " A good coding agent doesn't just write code and ship it —\n", + " it verifies the code works before declaring done.\n", + " \n", + " Scoring:\n", + " - Ran tests after last write: +0.5\n", + " - Ran linter after last write: +0.3 (bonus, included in 0.5)\n", + " - No verification = 0.0\n", + " \"\"\"\n", + " if not tool_history:\n", + " return 0.0\n", + " \n", + " # Find last write action\n", + " last_write = None\n", + " for i in range(len(tool_history) - 1, -1, -1):\n", + " if tool_history[i][\"tool\"] == \"write_file\":\n", + " last_write = i\n", + " break\n", + " \n", + " if last_write is None:\n", + " return 0.0\n", + " \n", + " # Check if verification happened after writing\n", + " actions_after = tool_history[last_write + 1:]\n", + " verified = any(\n", + " h[\"tool\"] in (\"run_tests\", \"check_linter\", \"inspect_error\") \n", + " for h in actions_after\n", + " )\n", + " return 0.5 if verified else 0.0\n", + "\n", + "\n", + "# ── Combined Reward (weighted) ──────────────────────────────────\n", + "\n", + "def combined_reward(code_passed: bool, tool_history: List[Dict]) -> float:\n", + " \"\"\"Combined reward function for GRPO training.\n", + " \n", + " Weighted combination:\n", + " - Code correctness (passes tests): 50%\n", + " - Tool discipline (inspect before act): 30%\n", + " - Verification (test after write): 20%\n", + " \n", + " This weighting ensures the model learns BOTH:\n", + " 1. How to write correct code (correctness)\n", + " 2. HOW to write correct code (discipline + verification)\n", + " \"\"\"\n", + " r_correct = 1.0 if code_passed else 0.0\n", + " r_discipline = reward_tool_discipline(tool_history)\n", + " r_verify = reward_verification(tool_history)\n", + " \n", + " return 0.5 * r_correct + 0.3 * r_discipline + 0.2 * r_verify\n", + "\n", + "\n", + "# ── Reward function wrappers for TRL's GRPOTrainer ─────────────\n", + "# TRL expects reward functions that take (prompts, completions, **kwargs)\n", + "# and return a list of float rewards.\n", + "\n", + "def correctness_reward_func(prompts, completions, **kwargs) -> List[float]:\n", + " \"\"\"TRL-compatible reward function for code correctness.\n", + " Uses test execution results passed via kwargs.\n", + " \"\"\"\n", + " test_results = kwargs.get(\"test_results\", [None] * len(completions))\n", + " rewards = []\n", + " for result in test_results:\n", + " if result is not None and result.get(\"passed\"):\n", + " rewards.append(1.0)\n", + " else:\n", + " rewards.append(0.0)\n", + " return rewards\n", + "\n", + "\n", + "def discipline_reward_func(prompts, completions, **kwargs) -> List[float]:\n", + " \"\"\"TRL-compatible reward function for tool discipline.\"\"\"\n", + " tool_histories = kwargs.get(\"tool_histories\", [[] for _ in completions])\n", + " return [reward_tool_discipline(h) for h in tool_histories]\n", + "\n", + "\n", + "def verification_reward_func(prompts, completions, **kwargs) -> List[float]:\n", + " \"\"\"TRL-compatible reward function for verification.\"\"\"\n", + " tool_histories = kwargs.get(\"tool_histories\", [[] for _ in completions])\n", + " return [reward_verification(h) for h in tool_histories]\n", + "\n", + "\n", + "# ── Test reward functions ────────────────────────────────────────\n", + "print(\"🧪 Testing reward functions...\")\n", + "\n", + "# Scenario 1: Model reads then writes (good discipline)\n", + "good_history = [\n", + " {\"tool\": \"read_file\", \"path\": \"main.py\", \"success\": True},\n", + " {\"tool\": \"search_code\", \"pattern\": \"def process\", \"matches\": 3},\n", + " {\"tool\": \"write_file\", \"path\": \"main.py\", \"success\": True},\n", + " {\"tool\": \"run_tests\", \"passed\": True},\n", + "]\n", + "r = combined_reward(True, good_history)\n", + "print(f\" Good discipline + correct: reward = {r:.2f}\")\n", + "\n", + "# Scenario 2: Model just writes (bad discipline)\n", + "bad_history = [\n", + " {\"tool\": \"write_file\", \"path\": \"main.py\", \"success\": True},\n", + " {\"tool\": \"run_tests\", \"passed\": True},\n", + "]\n", + "r = combined_reward(True, bad_history)\n", + "print(f\" Bad discipline + correct: reward = {r:.2f}\")\n", + "\n", + "# Scenario 3: Good discipline but wrong code\n", + "r = combined_reward(False, good_history)\n", + "print(f\" Good discipline + incorrect: reward = {r:.2f}\")\n", + "\n", + "# Scenario 4: Bad discipline + wrong code + no verification\n", + "worst_history = [\n", + " {\"tool\": \"write_file\", \"path\": \"main.py\", \"success\": True},\n", + "]\n", + "r = combined_reward(False, worst_history)\n", + "print(f\" Bad discipline + incorrect: reward = {r:.2f}\")\n", + "\n", + "print(\"\\n✅ Reward functions ready!\")\n", + "print(\" Weights: correctness=50%, discipline=30%, verification=20%\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "aa30e3f5", + "metadata": { + "papermill": { + "duration": 0.031301, + "end_time": "2026-06-28T01:04:49.008670+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:48.977369+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 6 — Prepare training data for GRPO\n", + "\n", + "GRPO needs problems with:\n", + "1. A problem statement (prompt)\n", + "2. A way to verify solutions (tests)\n", + "3. Reference code (for SFT warmup)\n", + "\n", + "We load from multiple sources, same as v3 but adapted for GRPO format.\n", + "Each example includes tool-use format training data in the THINK→INSPECT→ACT→VERIFY pattern.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f96592f0", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:04:49.072249Z", + "iopub.status.busy": "2026-06-28T01:04:49.071643Z", + "iopub.status.idle": "2026-06-28T01:09:34.869276Z", + "shell.execute_reply": "2026-06-28T01:09:34.868452Z" + }, + "papermill": { + "duration": 285.865561, + "end_time": "2026-06-28T01:09:34.904975+00:00", + "exception": false, + "start_time": "2026-06-28T01:04:49.039414+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import os, gc, json, random, hashlib, shutil\n", + "from datasets import load_dataset, Dataset\n", + "from pathlib import Path\n", + "\n", + "# ─── DISK-SAFE KAGGLE CONFIG ─────────────────────────────────────────────\n", + "# Kaggle gives ~60 GB total disk. The HF datasets cache defaults to\n", + "# /root/.cache/huggingface/ (on that same 60 GB disk), so loading\n", + "# newfacade/LeetCodeDataset (50k+ problems) + WaltonFuture/agentic-sft-new\n", + "# in full will blow the disk before you ever get to training.\n", + "#\n", + "# Fix:\n", + "# 1) Redirect the HF cache to /kaggle/temp/hf_cache (scratch disk,\n", + "# does NOT count toward your 20 GB committed-output cap)\n", + "# 2) Use streaming=True for the two huge datasets (LeetCode, agentic)\n", + "# — rows are yielded one at a time and NEVER cached to disk\n", + "# 3) Use split=\"train[:N]\" slicing for medium datasets (MBPP, SWE-bench)\n", + "# 4) gc.collect() + remove cached arrow files between sources\n", + "#\n", + "# All four together keep peak disk usage under ~5 GB for this cell.\n", + "\n", + "os.environ[\"HF_DATASETS_CACHE\"] = \"/kaggle/temp/hf_cache/datasets\"\n", + "os.environ[\"HF_HOME\"] = \"/kaggle/temp/hf_cache\"\n", + "os.environ[\"HF_HUB_CACHE\"] = \"/kaggle/temp/hf_cache/hub\"\n", + "os.makedirs(\"/kaggle/temp/hf_cache/datasets\", exist_ok=True)\n", + "os.makedirs(\"/kaggle/temp/hf_cache/hub\", exist_ok=True)\n", + "\n", + "# Per-source caps — tune down if you still see disk pressure.\n", + "MAX_HUMANEVAL = 164 # entire dataset (tiny)\n", + "MAX_MBPP = 500 # slice of 974\n", + "MAX_SWEBENCH = 300 # slice of ~500\n", + "MAX_LEETCODE = 500 # streaming cap (full dataset is huge)\n", + "MAX_AGENTIC = 500 # streaming cap (full dataset is huge)\n", + "\n", + "random.seed(42)\n", + "\n", + "def _disk_usage_gb(path):\n", + " \"\"\"Return disk usage of `path` in GB (best-effort).\"\"\"\n", + " try:\n", + " total = 0\n", + " for root, _, files in os.walk(path):\n", + " for f in files:\n", + " try:\n", + " total += os.path.getsize(os.path.join(root, f))\n", + " except OSError:\n", + " pass\n", + " return total / 1e9\n", + " except Exception:\n", + " return -1\n", + "\n", + "def cleanup_after_load(dataset_name):\n", + " \"\"\"Free Python memory + remove the HF cache for this dataset.\"\"\"\n", + " gc.collect()\n", + " cache_root = \"/kaggle/temp/hf_cache/datasets\"\n", + " # Dataset cache dirs are named like ___\n", + " safe_token = dataset_name.replace(\"/\", \"___\").lower()\n", + " for d in os.listdir(cache_root):\n", + " if safe_token in d.lower() or dataset_name.split(\"/\")[-1].lower() in d.lower():\n", + " shutil.rmtree(os.path.join(cache_root, d), ignore_errors=True)\n", + " print(f\" [disk] cache cleared for {dataset_name}, \"\n", + " f\"hf_cache size now {_disk_usage_gb('/kaggle/temp/hf_cache'):.2f} GB\")\n", + "\n", + "# ── System prompt (v4 — SGS + GRPO + Tool Discipline) ──────────\n", + "SYSTEM_V4 = \"\"\"You are TIMPS-Coder v4, an elite coding agent built by Sandeep Reddy (TIMPS).\n", + "\n", + "You are trained with Self-Guided Self-Play (SGS) + Group Relative Policy Optimization (GRPO) + Tool Discipline.\n", + "\n", + "Specializations:\n", + "- Real GitHub issue resolution with precise patches\n", + "- Agentic code editing: multi-step reasoning + tool use\n", + "- Repository navigation and root-cause analysis\n", + "- Competitive algorithm problem solving\n", + "- Bug diagnosis and systematic repair\n", + "\n", + "For every task, follow this protocol:\n", + "1. THINK — Analyze the problem and plan your approach\n", + "2. INSPECT — Use tools (read_file, search_code, inspect_error) to understand the codebase\n", + "3. ACT — Write or edit code using write_file\n", + "4. VERIFY — Run tests (run_tests) and linters (check_linter) to confirm\n", + "\n", + "Available tools: read_file, write_file, run_tests, check_linter, inspect_error, search_code\n", + "\n", + "ALWAYS inspect before acting. Read the code, understand the error, THEN write your fix.\"\"\"\n", + "\n", + "# ── Quality filter ──────────────────────────────────────────────\n", + "CODE_SIGNALS = [\n", + " \"```python\", \"```javascript\", \"```java\", \"```typescript\", \"```go\",\n", + " \"```rust\", \"```cpp\", \"```diff\", \"```bash\",\n", + " \"def \", \"class \", \"function \", \"const \", \"import \",\n", + " \"return \", \"if (\", \"patch\", \"--- a/\", \"+++ b/\",\n", + "]\n", + "NON_CODE = [\n", + " \"paternal grandmother\", \"born in\", \"wikipedia\",\n", + " \"politician\", \"biography\", \"\", \"browsing-agent\",\n", + " \"nationality\", \"married to\",\n", + "]\n", + "\n", + "def is_coding(text: str) -> bool:\n", + " t = text[:3000]\n", + " if any(s.lower() in t.lower() for s in NON_CODE):\n", + " return False\n", + " return any(s in t for s in CODE_SIGNALS)\n", + "\n", + "def safe_load(name, split=\"train\", streaming=False, **kw):\n", + " try:\n", + " return load_dataset(name, split=split, streaming=streaming, **kw)\n", + " except Exception as e:\n", + " print(f\" ⚠️ {name}: {e}\")\n", + " return None\n", + "\n", + "# ── ChatML formatter (Qwen2.5 uses ChatML) ─────────────────────\n", + "def fmt_grpo(instruction, response):\n", + " \"\"\"Format for GRPO training — prompt only, model generates completion.\"\"\"\n", + " return (\n", + " f\"<|im_start|>system\\n{SYSTEM_V4}<|im_end|>\\n\"\n", + " f\"<|im_start|>user\\n{instruction.strip()}<|im_end|>\\n\"\n", + " f\"<|im_start|>assistant\\n{response.strip()}<|im_end|>\"\n", + " )\n", + "\n", + "def fmt_sft(instruction, response):\n", + " \"\"\"Format for SFT warmup — full text for supervised training.\"\"\"\n", + " return fmt_grpo(instruction, response)\n", + "\n", + "# ── GRPO Dataset format ─────────────────────────────────────────\n", + "sft_examples = [] # For SFT warmup\n", + "grpo_problems = [] # For GRPO training\n", + "\n", + "print(f\"[disk] starting hf_cache size: \"\n", + " f\"{_disk_usage_gb('/kaggle/temp/hf_cache'):.2f} GB\")\n", + "\n", + "# ── [1] HumanEval (164 problems with test cases) ───────────────\n", + "print(\"[1/5] Loading HumanEval...\")\n", + "ds = safe_load(\"openai/openai_humaneval\", split=\"test\")\n", + "humaneval_count = 0\n", + "if ds:\n", + " for row in ds:\n", + " prompt = (row.get(\"prompt\") or \"\").strip()\n", + " test = row.get(\"test\", \"\")\n", + " entry_point = row.get(\"entry_point\", \"\")\n", + " canonical = row.get(\"canonical_solution\", \"\")\n", + "\n", + " if not prompt or not test:\n", + " continue\n", + "\n", + " problem = {\n", + " \"prompt\": f\"Solve this coding problem. Write a Python function.\\n\\n{prompt}\",\n", + " \"test_cases\": test,\n", + " \"entry_point\": entry_point,\n", + " \"reference\": canonical,\n", + " \"difficulty\": \"easy\",\n", + " \"category\": \"algorithm\",\n", + " \"source\": \"humaneval\",\n", + " }\n", + " grpo_problems.append(problem)\n", + "\n", + " instruction = f\"Solve this coding problem:\\n\\n{prompt}\"\n", + " response = (\n", + " f\"**THINK:**\\nLet me analyze this problem step by step.\\n\\n\"\n", + " f\"**ACT:**\\n```python\\n{canonical}\\n```\\n\\n\"\n", + " f\"**VERIFY:**\\nThe solution handles the required cases.\"\n", + " )\n", + " sft_examples.append({\"text\": fmt_sft(instruction, response)})\n", + " humaneval_count += 1\n", + "\n", + " if humaneval_count >= MAX_HUMANEVAL:\n", + " break\n", + "\n", + " print(f\" ✓ {humaneval_count} from HumanEval\")\n", + "del ds\n", + "cleanup_after_load(\"openai/openai_humaneval\")\n", + "\n", + "# ── [2] MBPP (sliced to first MAX_MBPP rows) ───────────────────\n", + "print(f\"[2/5] Loading MBPP (first {MAX_MBPP})...\")\n", + "ds = safe_load(\"google-research-datasets/mbpp\", split=f\"train[:{MAX_MBPP}]\")\n", + "mbpp_count = 0\n", + "if ds:\n", + " for row in ds:\n", + " text = (row.get(\"text\") or row.get(\"prompt\") or \"\").strip()\n", + " code = (row.get(\"code\") or \"\").strip()\n", + " test_list = row.get(\"test_list\", [])\n", + "\n", + " if not text or not code:\n", + " continue\n", + "\n", + " problem = {\n", + " \"prompt\": f\"Solve this coding problem:\\n\\n{text}\",\n", + " \"test_cases\": \"\\n\".join(test_list) if test_list else \"\",\n", + " \"reference\": code,\n", + " \"difficulty\": \"easy\",\n", + " \"category\": \"algorithm\",\n", + " \"source\": \"mbpp\",\n", + " }\n", + " grpo_problems.append(problem)\n", + "\n", + " instruction = f\"Solve this coding problem:\\n\\n{text}\"\n", + " response = (\n", + " f\"**THINK:**\\nAnalyzing the requirements.\\n\\n\"\n", + " f\"**ACT:**\\n```python\\n{code[:500]}\\n```\\n\\n\"\n", + " f\"**VERIFY:**\\nSolution passes the given test cases.\"\n", + " )\n", + " sft_examples.append({\"text\": fmt_sft(instruction, response)})\n", + " mbpp_count += 1\n", + "\n", + " print(f\" ✓ {mbpp_count} from MBPP\")\n", + "del ds\n", + "cleanup_after_load(\"google-research-datasets/mbpp\")\n", + "\n", + "# ── [3] SWE-bench Verified (sliced to first MAX_SWEBENCH) ──────\n", + "print(f\"[3/5] Loading SWE-bench Verified (first {MAX_SWEBENCH})...\")\n", + "ds = safe_load(\"princeton-nlp/SWE-bench_Verified\", split=f\"test[:{MAX_SWEBENCH}]\")\n", + "if ds is None:\n", + " ds = safe_load(\"SWE-bench/SWE-bench_Verified\", split=f\"test[:{MAX_SWEBENCH}]\")\n", + "swe_count = 0\n", + "if ds:\n", + " for row in ds:\n", + " problem = (row.get(\"problem_statement\") or \"\").strip()\n", + " patch = (row.get(\"patch\") or \"\").strip()\n", + " repo = row.get(\"repo\", \"unknown\")\n", + " if not problem or not patch or len(patch) < 20:\n", + " continue\n", + "\n", + " instruction = f\"**Repo:** `{repo}`\\n\\n**Issue:**\\n{problem[:800]}\"\n", + " response = (\n", + " f\"**THINK:**\\nAnalyzing root cause in `{repo}`.\\n\\n\"\n", + " f\"**INSPECT:**\\nread_file('{repo.split('/')[-1]}/src/main.py')\\n\\n\"\n", + " f\"**ACT — Patch:**\\n```diff\\n{patch[:1800]}\\n```\\n\\n\"\n", + " f\"**VERIFY:**\\nMinimal targeted patch. Run `pytest` to confirm no regressions.\"\n", + " )\n", + " if is_coding(response):\n", + " sft_examples.append({\"text\": fmt_sft(instruction, response)})\n", + " grpo_problems.append({\n", + " \"prompt\": instruction,\n", + " \"test_cases\": \"\",\n", + " \"reference\": patch,\n", + " \"difficulty\": \"hard\",\n", + " \"category\": \"swe\",\n", + " \"source\": \"swebench\",\n", + " })\n", + " swe_count += 1\n", + "\n", + " print(f\" ✓ {swe_count} from SWE-bench\")\n", + "del ds\n", + "cleanup_after_load(\"princeton-nlp/SWE-bench_Verified\")\n", + "\n", + "# ── [4] LeetCode — STREAMING (full dataset is huge) ────────────\n", + "print(f\"[4/5] Loading LeetCode (streaming, cap {MAX_LEETCODE})...\")\n", + "ds = safe_load(\"newfacade/LeetCodeDataset\", split=\"train\", streaming=True)\n", + "leetcode_count = 0\n", + "if ds:\n", + " for row in ds:\n", + " title = (row.get(\"task_id\") or row.get(\"title\") or \"Problem\").strip()\n", + " desc = (row.get(\"query\") or row.get(\"problem_description\") or\n", + " row.get(\"description\") or row.get(\"content\") or \"\").strip()\n", + " sol = (row.get(\"response\") or row.get(\"solution\") or\n", + " row.get(\"python_solution\") or \"\").strip()\n", + " diff = row.get(\"difficulty\", \"Medium\")\n", + "\n", + " if not desc or not sol or len(sol) < 30:\n", + " continue\n", + "\n", + " instruction = f\"**{title}** ({diff})\\n\\n{desc[:600]}\"\n", + " response = (\n", + " f\"**THINK:**\\nBreaking down the problem.\\n\\n\"\n", + " f\"**ACT:**\\n```python\\n{sol[:800]}\\n```\\n\\n\"\n", + " f\"**VERIFY:**\\nTest with edge cases.\"\n", + " )\n", + " if is_coding(response):\n", + " sft_examples.append({\"text\": fmt_sft(instruction, response)})\n", + " grpo_problems.append({\n", + " \"prompt\": instruction,\n", + " \"test_cases\": \"\",\n", + " \"reference\": sol,\n", + " \"difficulty\": diff.lower() if isinstance(diff, str) else \"medium\",\n", + " \"category\": \"algorithm\",\n", + " \"source\": \"leetcode\",\n", + " })\n", + " leetcode_count += 1\n", + "\n", + " if leetcode_count >= MAX_LEETCODE:\n", + " break\n", + "\n", + " print(f\" ✓ {leetcode_count} from LeetCode (streamed)\")\n", + "del ds\n", + "# Streaming datasets don't write to the cache, but be safe:\n", + "cleanup_after_load(\"newfacade/LeetCodeDataset\")\n", + "\n", + "# ── [5] Agentic SFT — STREAMING ────────────────────────────────\n", + "print(f\"[5/5] Loading agentic SFT (streaming, cap {MAX_AGENTIC})...\")\n", + "ds = safe_load(\"WaltonFuture/agentic-sft-new\", split=\"train\", streaming=True)\n", + "agentic_count = 0\n", + "if ds:\n", + " for row in ds:\n", + " convs = row.get(\"conversations\") or row.get(\"messages\") or []\n", + " parts = [f\"<|im_start|>system\\n{SYSTEM_V4}<|im_end|>\"]\n", + " ok = True\n", + " for turn in convs:\n", + " if not isinstance(turn, dict):\n", + " ok = False; break\n", + " role = (turn.get(\"from\") or turn.get(\"role\") or \"\").lower()\n", + " content = (turn.get(\"value\") or turn.get(\"content\") or \"\").strip()\n", + " if not content:\n", + " continue\n", + " if role in (\"gpt\", \"assistant\"):\n", + " if not is_coding(content):\n", + " ok = False; break\n", + " parts.append(f\"<|im_start|>assistant\\n{content[:900]}<|im_end|>\")\n", + " else:\n", + " parts.append(f\"<|im_start|>user\\n{content[:700]}<|im_end|>\")\n", + " if ok and len(parts) >= 3:\n", + " text = \"\\n\".join(parts)\n", + " if 200 < len(text) < 6500:\n", + " sft_examples.append({\"text\": text})\n", + " agentic_count += 1\n", + "\n", + " if agentic_count >= MAX_AGENTIC:\n", + " break\n", + "\n", + " print(f\" ✓ {agentic_count} from agentic SFT (streamed)\")\n", + "del ds\n", + "cleanup_after_load(\"WaltonFuture/agentic-sft-new\")\n", + "\n", + "# ── Deduplicate ─────────────────────────────────────────────────\n", + "print(\"\\nDeduplicating...\")\n", + "seen = set()\n", + "unique_sft = []\n", + "for ex in sft_examples:\n", + " h = hashlib.md5(ex[\"text\"].encode()).hexdigest()\n", + " if h not in seen:\n", + " seen.add(h)\n", + " unique_sft.append(ex)\n", + "\n", + "# ── Split ───────────────────────────────────────────────────────\n", + "random.shuffle(unique_sft)\n", + "split = int(0.95 * len(unique_sft))\n", + "train_sft = Dataset.from_list(unique_sft[:split])\n", + "valid_sft = Dataset.from_list(unique_sft[split:])\n", + "\n", + "# GRPO dataset\n", + "random.shuffle(grpo_problems)\n", + "grpo_split = int(0.9 * len(grpo_problems))\n", + "grpo_train = Dataset.from_list(grpo_problems[:grpo_split])\n", + "grpo_valid = Dataset.from_list(grpo_problems[grpo_split:])\n", + "\n", + "# Free the raw lists — they're now in HF Dataset objects\n", + "# Save grpo_problems to disk before deleting from memory.\n", + "# The SGS cell (after DPO) needs to filter it by difficulty -- if we just\n", + "# del it here, that cell crashes with NameError: name 'grpo_problems' is not defined.\n", + "import json as _json\n", + "_gp_path = f\"{WORK_DIR}/grpo_problems.json\"\n", + "with open(_gp_path, 'w') as _f:\n", + " _json.dump(grpo_problems, _f)\n", + "print(f\" Saved grpo_problems ({len(grpo_problems)} items) to {_gp_path}\")\n", + "\n", + "del sft_examples, grpo_problems, unique_sft\n", + "gc.collect()\n", + "\n", + "print(f\"\\n{'='*50}\")\n", + "print(f\" Dataset Summary\")\n", + "print(f\"{'='*50}\")\n", + "print(f\" SFT Training Examples : {len(train_sft):,}\")\n", + "print(f\" SFT Validation : {len(valid_sft):,}\")\n", + "print(f\" GRPO Problems (train) : {len(grpo_train):,}\")\n", + "print(f\" GRPO Problems (valid) : {len(grpo_valid):,}\")\n", + "print(f\" ✅ Ready for training\")\n", + "print(f\"{'='*50}\")\n", + "print(f\"\\n[disk] final hf_cache size: \"\n", + " f\"{_disk_usage_gb('/kaggle/temp/hf_cache'):.2f} GB\")\n", + "print(f\"[disk] /kaggle/working size: \"\n", + " f\"{_disk_usage_gb('/kaggle/working'):.2f} GB\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "8cd8a197", + "metadata": { + "papermill": { + "duration": 0.031798, + "end_time": "2026-06-28T01:09:34.969535+00:00", + "exception": false, + "start_time": "2026-06-28T01:09:34.937737+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 3: STEP 2 — TRAIN WITH GRPO\n", + "\n", + "This phase loads the 7B model, applies LoRA, does an SFT warmup,\n", + "then runs GRPO training with our tool-discipline reward functions.\n", + "\n", + "**Training order matters:**\n", + "1. SFT warmup → teaches the model the tool-use format\n", + "2. GRPO → reinforces good behavior with RL rewards\n", + "3. (Later: DPO → aligns preferences)\n", + "\n", + "**Why GRPO instead of PPO?**\n", + "- No critic model needed (saves 50% compute)\n", + "- Group-relative normalization (more stable)\n", + "- Same method used by DeepSeek-R1\n", + "\n", + "**Kaggle note:** On T4 (15 GB) we use 4-bit QLoRA + gradient checkpointing to fit a 7B model\n", + "with 4096-token context and 4 GRPO generations per prompt.\n" + ] + }, + { + "cell_type": "markdown", + "id": "2fcc0b9a", + "metadata": { + "papermill": { + "duration": 0.032751, + "end_time": "2026-06-28T01:09:35.035550+00:00", + "exception": false, + "start_time": "2026-06-28T01:09:35.002799+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 7 — Load Qwen2.5-Coder-7B-Instruct with Unsloth\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6db3ec16", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:09:35.101812Z", + "iopub.status.busy": "2026-06-28T01:09:35.101532Z", + "iopub.status.idle": "2026-06-28T01:10:06.862820Z", + "shell.execute_reply": "2026-06-28T01:10:06.861781Z" + }, + "papermill": { + "duration": 31.828737, + "end_time": "2026-06-28T01:10:06.897050+00:00", + "exception": false, + "start_time": "2026-06-28T01:09:35.068313+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# Force quiet installations and ignore dependency conflicts with pre-installed Kaggle packages\n", + "!pip install -q --no-warn-conflicts unsloth_zoo\n", + "!pip install -q --no-warn-conflicts \"unsloth @ git+https://github.com/unslothai/unsloth.git\"\n", + "print(\"✅ Environment setup complete without logging clutter!\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8e83eeb5", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:10:06.963868Z", + "iopub.status.busy": "2026-06-28T01:10:06.963587Z", + "iopub.status.idle": "2026-06-28T01:11:08.953785Z", + "shell.execute_reply": "2026-06-28T01:11:08.952729Z" + }, + "papermill": { + "duration": 62.065493, + "end_time": "2026-06-28T01:11:08.994657+00:00", + "exception": false, + "start_time": "2026-06-28T01:10:06.929164+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "from unsloth import FastLanguageModel\n", + "import torch\n", + "\n", + "# -- Config --\n", + "BASE_MODEL = \"Qwen/Qwen2.5-Coder-7B-Instruct\"\n", + "HF_USERNAME = \"sandeeprdy1729\"\n", + "HF_REPO = f\"{HF_USERNAME}/TIMPS-Coder-7B\"\n", + "MAX_SEQ_LEN = BUDGET_MAX_SEQ_LEN # auto-scaled by GPU tier (2048 on T4, 4096 on A100)\n", + "\n", + "# ===========================================================================\n", + "# LORA_RANK PINNED TO 64 -- DO NOT let this auto-scale by GPU tier anymore.\n", + "# ===========================================================================\n", + "# Your SFT checkpoint (checkpoint-750) was saved with rank=64. If a future\n", + "# session auto-detects a lower GPU tier and BUDGET_LORA_RANK comes back as 32,\n", + "# model.load_adapter() will crash with a shape mismatch (64 vs 32 in every\n", + "# LoRA layer) -- this is exactly the RuntimeError you hit. Pinning this value\n", + "# keeps every session's LoRA shape consistent with your existing checkpoints,\n", + "# regardless of which GPU tier gets detected. This costs a bit more VRAM than\n", + "# the auto-scaled rank=32 would on T4, but QLoRA 4-bit + gradient checkpointing\n", + "# still fits a 7B model at rank=64 on a 15GB T4.\n", + "LORA_RANK = 64 # pinned -- must match the rank used in your original SFT run\n", + "\n", + "if BUDGET_LORA_RANK != LORA_RANK:\n", + " print(f\"NOTE: GPU-tier auto-detect suggested LORA_RANK={BUDGET_LORA_RANK}, \"\n", + " f\"but it is pinned to {LORA_RANK} to match your existing checkpoints.\")\n", + "# ---------------\n", + "\n", + "print(f\"Loading {BASE_MODEL}...\")\n", + "print(f\" 7B model with 4-bit QLoRA — fits comfortably on T4 (15 GB)\")\n", + "print(f\" MAX_SEQ_LEN = {MAX_SEQ_LEN} (GPU_TIER={GPU_TIER})\")\n", + "\n", + "model, tokenizer = FastLanguageModel.from_pretrained(\n", + " model_name = BASE_MODEL,\n", + " max_seq_length = MAX_SEQ_LEN,\n", + " dtype = None, # auto-detect (bf16 on A100, fp16 on T4/P100)\n", + " load_in_4bit = True, # QLoRA — fits in T4 15GB\n", + ")\n", + "\n", + "print(f\"Base model loaded\")\n", + "print(f\" Parameters: {sum(p.numel() for p in model.parameters()):,}\")\n", + "print(f\" Max seq length: {MAX_SEQ_LEN}\")\n", + "\n", + "# Set pad token if not set\n", + "if tokenizer.pad_token is None:\n", + " tokenizer.pad_token = tokenizer.eos_token\n" + ] + }, + { + "cell_type": "markdown", + "id": "cdd2eb3c", + "metadata": { + "papermill": { + "duration": 0.038275, + "end_time": "2026-06-28T01:11:09.071285+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:09.033010+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 8 — Apply LoRA for GRPO training (rank=64, RSLoRA)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e8bd4642", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:11:09.147084Z", + "iopub.status.busy": "2026-06-28T01:11:09.146073Z", + "iopub.status.idle": "2026-06-28T01:11:15.878028Z", + "shell.execute_reply": "2026-06-28T01:11:15.876888Z" + }, + "papermill": { + "duration": 6.771193, + "end_time": "2026-06-28T01:11:15.880540+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:09.109347+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# LORA_RANK is pinned to 64 in Cell 20 (no longer auto-scaled by GPU tier) so\n", + "# every session matches the rank used in your existing SFT/GRPO/DPO checkpoints.\n", + "# RSLoRA stays on -- better RL stability.\n", + "\n", + "model = FastLanguageModel.get_peft_model(\n", + " model,\n", + " r = LORA_RANK,\n", + " lora_alpha = LORA_RANK, # scale = rank (standard ratio)\n", + " lora_dropout = 0.05,\n", + " target_modules = [ # all linear layers in Qwen2.5\n", + " \"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\n", + " \"gate_proj\", \"up_proj\", \"down_proj\",\n", + " ],\n", + " bias = \"none\",\n", + " use_gradient_checkpointing = \"unsloth\", # saves ~30% VRAM\n", + " random_state = 42,\n", + " use_rslora = True, # Rank-Stabilized LoRA — more stable for RL\n", + " loftq_config = None,\n", + ")\n", + "\n", + "trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)\n", + "total = sum(p.numel() for p in model.parameters())\n", + "print(f\"LoRA applied (rank={LORA_RANK})\")\n", + "print(f\" Trainable params: {trainable:,} ({100*trainable/total:.2f}%)\")\n", + "print(f\" Total params : {total:,}\")\n", + "print(f\" LoRA rank : {LORA_RANK}\")\n", + "print(f\" RSLoRA : enabled (more stable for GRPO)\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "f0b468cd", + "metadata": { + "papermill": { + "duration": 0.035871, + "end_time": "2026-06-28T01:11:15.956746+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:15.920875+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Resume Point — Load Previous SFT Checkpoint (cross-session)\n", + "\n", + "If you already completed SFT in an earlier Kaggle session (e.g. 750/750 steps,\n", + "~11.5h), attach that session's Output as an Input to this notebook and set\n", + "`SFT_CHECKPOINT_PATH` below to skip retraining SFT and jump straight to GRPO.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab535f87", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:11:16.034642Z", + "iopub.status.busy": "2026-06-28T01:11:16.033759Z", + "iopub.status.idle": "2026-06-28T01:11:20.717200Z", + "shell.execute_reply": "2026-06-28T01:11:20.716308Z" + }, + "papermill": { + "duration": 4.722757, + "end_time": "2026-06-28T01:11:20.718901+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:15.996144+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# ===========================================================================\n", + "# RESUME FROM PREVIOUS SFT RUN (cross-session checkpoint loading)\n", + "# ===========================================================================\n", + "# Your last Kaggle session finished SFT at 750/750 steps and the Output was\n", + "# saved. Kaggle wipes /kaggle/working between sessions, so this cell loads\n", + "# the trained LoRA adapter weights from wherever you attached that Output\n", + "# (Add Input -> Notebook Output Files, or a Dataset built from it).\n", + "#\n", + "# HOW TO USE:\n", + "# 1. Attach the old notebook's Output/Dataset to THIS session\n", + "# (Add Input button in the right sidebar).\n", + "# 2. Find the checkpoint path:\n", + "# !find /kaggle/input -maxdepth 6 -iname \"checkpoint-*\" -type d\n", + "# 3. Paste the matching path below (the highest checkpoint-N you have,\n", + "# e.g. checkpoint-750 if you saved at the final step, or whatever\n", + "# the highest save_steps multiple was).\n", + "# 4. Leave SFT_CHECKPOINT_PATH = None to train SFT from scratch instead.\n", + "\n", + "SFT_CHECKPOINT_PATH = \"/kaggle/input/notebooks/sandeepautomation/newnote/timps-coder-v4/sft-warmup/checkpoint-750\" # <-- e.g. \"/kaggle/input//timps-coder-v4/sft-warmup/checkpoint-750\"\n", + "\n", + "SFT_ALREADY_DONE = False\n", + "\n", + "if SFT_CHECKPOINT_PATH:\n", + " import os\n", + " if not os.path.isdir(SFT_CHECKPOINT_PATH):\n", + " raise FileNotFoundError(\n", + " f\"SFT_CHECKPOINT_PATH does not exist: {SFT_CHECKPOINT_PATH}\\n\"\n", + " f\"Run: !find /kaggle/input -maxdepth 6 -iname 'checkpoint-*' -type d\\n\"\n", + " f\"to locate the correct path after attaching your old Output as an input.\"\n", + " )\n", + " has_weights = (\n", + " os.path.isfile(f\"{SFT_CHECKPOINT_PATH}/adapter_model.safetensors\")\n", + " or os.path.isfile(f\"{SFT_CHECKPOINT_PATH}/adapter_model.bin\")\n", + " )\n", + " if not has_weights:\n", + " raise FileNotFoundError(\n", + " f\"No adapter weights found in {SFT_CHECKPOINT_PATH}. \"\n", + " f\"Expected adapter_model.safetensors (LoRA-only checkpoint, since \"\n", + " f\"SFT was run with save_only_model=True).\"\n", + " )\n", + "\n", + " print(f\"Loading SFT-trained LoRA adapter from: {SFT_CHECKPOINT_PATH}\")\n", + " # model already has a (freshly initialized, untrained) LoRA adapter applied\n", + " # by FastLanguageModel.get_peft_model() in the previous cell. We overwrite\n", + " # those weights with the trained ones from disk using PEFT's adapter loader.\n", + " model.load_adapter(SFT_CHECKPOINT_PATH, adapter_name=\"default\", is_trainable=True)\n", + "\n", + " trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)\n", + " print(f\"Resumed SFT adapter loaded successfully.\")\n", + " print(f\" Trainable params: {trainable:,}\")\n", + " print(f\" SFT training will be SKIPPED -- proceeding straight to GRPO.\")\n", + " SFT_ALREADY_DONE = True\n", + "else:\n", + " print(\"SFT_CHECKPOINT_PATH not set -- SFT will train from scratch in the next cell.\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "06746a44", + "metadata": { + "papermill": { + "duration": 0.033392, + "end_time": "2026-06-28T01:11:20.786827+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:20.753435+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "---\n", + "# ⚠️ FIX NOTICE — Read before running the SFT cell below\n", + "\n", + "## What broke\n", + "\n", + "The previous run crashed at checkpoint-250 with:\n", + "\n", + "```\n", + "PicklingError: Can't pickle :\n", + "it's not the same object as trl.trainer.sft_config.SFTConfig\n", + "```\n", + "\n", + "## Why\n", + "\n", + "The original SFT cell passed `transformers.TrainingArguments` to `trl.SFTTrainer`.\n", + "TRL internally converts that to `trl.SFTConfig`, but when `torch.save(self.args)`\n", + "runs at checkpoint time, the pickle lookup fails because Unsloth re-imports TRL\n", + "modules during its monkey-patching — breaking class identity.\n", + "\n", + "## The fix (already applied in the cell below)\n", + "\n", + "1. Use `trl.SFTConfig` directly (no conversion = no identity mismatch)\n", + "2. Use `processing_class=tokenizer` (modern TRL 0.12+ API; `tokenizer=` was removed)\n", + "3. Add `save_only_model=True` — skips saving optimizer/scheduler state, smaller checkpoints, avoids one pickle code path\n", + "4. Delete any leftover broken `sft-warmup/` directory before starting fresh\n", + "5. Same fix applied preemptively to the DPO cell (cell 31)\n", + "\n", + "## Action required\n", + "\n", + "If you have a half-written `checkpoint-250/` from the crashed run, the cell below\n", + "will automatically delete it before starting. You will lose the 4h of SFT progress\n", + "from the previous run — that's unavoidable because the checkpoint is corrupted.\n", + "\n", + "If you want to **resume from a known-good checkpoint** instead of restarting,\n", + "set `RESUME_FROM_CHECKPOINT = True` in the cell below and point it at a valid\n", + "checkpoint directory. (Default: False — start fresh.)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f6715a40", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:11:20.858138Z", + "iopub.status.busy": "2026-06-28T01:11:20.857660Z", + "iopub.status.idle": "2026-06-28T01:11:20.871198Z", + "shell.execute_reply": "2026-06-28T01:11:20.870482Z" + }, + "papermill": { + "duration": 0.049861, + "end_time": "2026-06-28T01:11:20.872790+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:20.822929+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import os, shutil, glob\n", + "from transformers import DataCollatorForSeq2Seq\n", + "from trl import SFTConfig, SFTTrainer # <-- SFTConfig from trl, NOT TrainingArguments from transformers\n", + "import math\n", + "\n", + "# ===========================================================================\n", + "# SKIP SFT ENTIRELY IF RESUMING FROM A PRIOR CHECKPOINT\n", + "# ===========================================================================\n", + "# SFT_ALREADY_DONE is set by the \"Resume Point\" cell above. If a checkpoint\n", + "# was loaded there, the model already has trained SFT weights -- running\n", + "# this cell again would waste the rest of your Kaggle session re-doing\n", + "# 11.5 hours of work for nothing.\n", + "if SFT_ALREADY_DONE:\n", + " print(\"=\" * 50)\n", + " print(\"SFT_ALREADY_DONE = True -- skipping SFT training.\")\n", + " print(\"Using the resumed adapter weights loaded from SFT_CHECKPOINT_PATH.\")\n", + " print(\"=\" * 50)\n", + "else:\n", + "\n", + " # ===========================================================================\n", + " # RESUME OPTION\n", + " # ===========================================================================\n", + " # Set to a path like f\"{OUTPUT_DIR}/sft-warmup/checkpoint-500\" to resume\n", + " # from a known-good checkpoint. Leave None to start fresh.\n", + " # (The checkpoint-250 from your previous run is CORRUPTED — do not resume\n", + " # from it. Let the cleanup below delete it.)\n", + " RESUME_FROM_CHECKPOINT = None\n", + "\n", + " # ===========================================================================\n", + " # CLEANUP — delete any broken / partial checkpoints from the previous run\n", + " # ===========================================================================\n", + " sft_output = f\"{OUTPUT_DIR}/sft-warmup\"\n", + " if os.path.isdir(sft_output):\n", + " print(f\"Cleaning up existing SFT output dir: {sft_output}\")\n", + " # Specifically remove checkpoint-250 if it's incomplete (no .safetensors)\n", + " for ckpt in sorted(glob.glob(f\"{sft_output}/checkpoint-*\")):\n", + " has_weights = (\n", + " glob.glob(f\"{ckpt}/*.safetensors\")\n", + " or glob.glob(f\"{ckpt}/pytorch_model.bin\")\n", + " )\n", + " if not has_weights:\n", + " print(f\" Removing corrupted checkpoint (no weights): {ckpt}\")\n", + " shutil.rmtree(ckpt, ignore_errors=True)\n", + " else:\n", + " print(f\" Keeping valid checkpoint: {ckpt}\")\n", + " # If resume is None and any checkpoints remain, wipe them all to start fresh\n", + " if RESUME_FROM_CHECKPOINT is None:\n", + " for ckpt in sorted(glob.glob(f\"{sft_output}/checkpoint-*\")):\n", + " print(f\" Removing (fresh start requested): {ckpt}\")\n", + " shutil.rmtree(ckpt, ignore_errors=True)\n", + " else:\n", + " os.makedirs(sft_output, exist_ok=True)\n", + "\n", + " # ===========================================================================\n", + " # SFT CONFIG — use SFTConfig from trl (NOT TrainingArguments)\n", + " # ===========================================================================\n", + " # Why: TRL's SFTTrainer auto-converts TrainingArguments -> SFTConfig,\n", + " # and that conversion breaks torch.save(self.args) at checkpoint time\n", + " # because Unsloth has re-imported TRL modules (class identity mismatch).\n", + " # Passing SFTConfig directly sidesteps the conversion entirely.\n", + "\n", + " free_vram = torch.cuda.get_device_properties(0).total_memory / 1e9\n", + " if free_vram > 35:\n", + " BATCH, GRAD_ACCUM = 2, 4\n", + " elif free_vram > 12:\n", + " # T4 (15 GB) — small batch + grad accumulation to fit\n", + " BATCH, GRAD_ACCUM = 1, 16\n", + " else:\n", + " BATCH, GRAD_ACCUM = 1, 32\n", + "\n", + " EFFECTIVE_BATCH = BATCH * GRAD_ACCUM\n", + "\n", + " sft_args = SFTConfig(\n", + " output_dir = sft_output,\n", + " max_steps = SFT_MAX_STEPS,\n", + " per_device_train_batch_size = BATCH,\n", + " gradient_accumulation_steps = GRAD_ACCUM,\n", + " warmup_steps = 50,\n", + " learning_rate = 2e-5,\n", + " lr_scheduler_type = \"cosine\",\n", + " optim = \"adamw_torch\",\n", + " weight_decay = 0.01,\n", + " fp16 = not torch.cuda.is_bf16_supported(),\n", + " bf16 = torch.cuda.is_bf16_supported(),\n", + " logging_steps = 25,\n", + " save_strategy = \"steps\",\n", + " save_steps = 250,\n", + " save_total_limit = 2,\n", + " save_only_model = True, # <-- skip optimizer state, avoids 1 pickle path\n", + " report_to = \"none\",\n", + " seed = 42,\n", + " remove_unused_columns = False,\n", + " gradient_checkpointing = True,\n", + " gradient_checkpointing_kwargs = {\"use_reentrant\": False},\n", + "\n", + " # SFTConfig-specific\n", + " max_length = MAX_SEQ_LEN, # renamed from max_seq_length in TRL 0.12+\n", + " dataset_text_field = \"text\", # column in train_sft that holds the formatted text\n", + " packing = False, # don't pack short examples (better for tool-use format)\n", + " # NOTE: `group_by_length=True` was removed — TRL's SFTConfig in this version\n", + " # does not accept it (it was a TrainingArguments arg that TRL dropped when\n", + " # subclassing). Training still works without it; you just lose the minor\n", + " # padding-efficiency optimization. The DataCollatorForSeq2Seq below already\n", + " # pads to multiple_of=8 dynamically, so the impact is negligible.\n", + " )\n", + "\n", + " collator = DataCollatorForSeq2Seq(\n", + " tokenizer,\n", + " model=model,\n", + " label_pad_token_id=-100,\n", + " pad_to_multiple_of=8,\n", + " )\n", + "\n", + " # Modern TRL API: processing_class=tokenizer (not tokenizer=)\n", + " sft_trainer = SFTTrainer(\n", + " model = model,\n", + " args = sft_args,\n", + " train_dataset = train_sft,\n", + " data_collator = collator,\n", + " processing_class = tokenizer,\n", + " )\n", + "\n", + " print(f\"SFT Warmup Config:\")\n", + " print(f\" Batch size : {BATCH} x grad_accum {GRAD_ACCUM} = {EFFECTIVE_BATCH}\")\n", + " print(f\" Max steps : {SFT_MAX_STEPS}\")\n", + " print(f\" Learning rate : 2e-5 -> cosine\")\n", + " print(f\" Train examples : {len(train_sft):,}\")\n", + " print(f\" Resume from : {RESUME_FROM_CHECKPOINT or '(fresh start)'}\")\n", + " print(f\" args class : {type(sft_args).__name__} (should be SFTConfig)\")\n", + " print()\n", + "\n", + " print(\"Starting SFT warmup (teaching tool-use format)...\")\n", + " print(\"=\" * 50)\n", + " try:\n", + " if RESUME_FROM_CHECKPOINT:\n", + " sft_stats = sft_trainer.train(resume_from_checkpoint=RESUME_FROM_CHECKPOINT)\n", + " else:\n", + " sft_stats = sft_trainer.train()\n", + " except Exception as e:\n", + " print(f\"SFT training failed: {type(e).__name__}: {e}\")\n", + " print(\"\\nFallback: try with save_strategy='no' to skip checkpointing entirely.\")\n", + " print(\"Edit this cell: set save_strategy='no', save_steps=99999, save_total_limit=0\")\n", + " raise\n", + "\n", + " print(\"=\" * 50)\n", + " print(f\"SFT Warmup complete!\")\n", + " print(f\" Train loss : {sft_stats.training_loss:.4f}\")\n", + " print(f\" Total steps : {sft_stats.global_step}\")\n", + " runtime_mins = sft_stats.metrics.get('train_runtime', 0) / 60\n", + " print(f\" Runtime : {runtime_mins:.1f} minutes\")\n", + " print(f\" Model now understands THINK -> INSPECT -> ACT -> VERIFY format\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "8c245acd", + "metadata": { + "papermill": { + "duration": 0.03741, + "end_time": "2026-06-28T01:11:20.943491+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:20.906081+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 10 — GRPO Training (core RL training)\n", + "\n", + "This is the core training step. GRPO (Group Relative Policy Optimization) from DeepSeek-R1:\n", + "\n", + "1. For each prompt, generate N completions (the \"group\")\n", + "2. Score each completion using our reward functions\n", + "3. Normalize rewards within the group (that's the \"Group Relative\" part)\n", + "4. Update policy to prefer higher-reward completions\n", + "\n", + "**Key advantages over PPO:**\n", + "- No critic model needed (saves ~50% compute)\n", + "- More stable training (group normalization)\n", + "\n", + "**Kaggle T4 note:** GRPO generates 4 completions per prompt — this is the most VRAM-intensive\n", + "step. With 4-bit QLoRA + gradient checkpointing + max_completion_length=1024, we fit on T4.\n", + "If you hit OOM, reduce `NUM_GENERATIONS` to 2 below.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2ac0b7dd", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:11:21.097880Z", + "iopub.status.busy": "2026-06-28T01:11:21.097533Z", + "iopub.status.idle": "2026-06-28T01:11:22.129428Z", + "shell.execute_reply": "2026-06-28T01:11:22.128593Z" + }, + "papermill": { + "duration": 1.153379, + "end_time": "2026-06-28T01:11:22.131062+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:20.977683+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# ── OOM RECOVERY: free everything from SFT before starting GRPO ────────\n", + "# GRPO is the most VRAM-intensive step (generates N completions per prompt\n", + "# in parallel). On a 15 GB T4 there is NO headroom for leftovers from SFT.\n", + "# This cell:\n", + "# 1. Deletes the SFT trainer + its refs\n", + "# 2. Runs gc.collect() to release Python-side refs\n", + "# 3. Runs torch.cuda.empty_cache() to release PyTorch's reserved blocks\n", + "# 4. Prints nvidia-smi so you can confirm free VRAM before GRPO starts\n", + "\n", + "import gc, subprocess, torch\n", + "\n", + "# 1) Drop SFT trainer refs (variable was named sft_trainer in the previous cell)\n", + "try:\n", + " del sft_trainer\n", + " print('Deleted sft_trainer')\n", + "except NameError:\n", + " print('sft_trainer already gone (ok if you skipped SFT)')\n", + "\n", + "# 2) Drop SFT dataset refs we no longer need\n", + "for _name in ('train_sft', 'sft_args', 'collator'):\n", + " try:\n", + " globals().pop(_name, None)\n", + " except Exception:\n", + " pass\n", + "\n", + "# 3) Run collection + cache clear TWICE (once for Python, once for CUDA)\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n", + "\n", + "# 4) Print current VRAM state\n", + "print('\\\\n=== VRAM state before GRPO ===')\n", + "print(subprocess.run(['nvidia-smi'], capture_output=True, text=True).stdout)\n", + "if torch.cuda.is_available():\n", + " free, total = torch.cuda.mem_get_info()\n", + " print(f'Free: {free/1e9:.2f} GiB / Total: {total/1e9:.2f} GiB')\n", + " print(f'Reserved by PyTorch: {torch.cuda.memory_reserved()/1e9:.2f} GiB')\n", + " print(f'Allocated by PyTorch: {torch.cuda.memory_allocated()/1e9:.2f} GiB')\n" + ] + }, + { + "cell_type": "markdown", + "id": "366c8755", + "metadata": { + "papermill": { + "duration": 0.033253, + "end_time": "2026-06-28T01:11:22.199829+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:22.166576+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Resume Point — Load Previous GRPO Checkpoint (cross-session)\n", + "\n", + "GRPO checkpoints every `save_steps=200` steps to `{OUTPUT_DIR}/grpo/checkpoint-N`.\n", + "Since `/kaggle/working` does not survive between sessions, attach the previous\n", + "session's Output as an Input here (same as the SFT resume step) and point\n", + "`GRPO_RESUME_PATH` at the highest `checkpoint-N` you have.\n", + "\n", + "Two outcomes depending on how far GRPO got:\n", + "- **Mid-training** (didn't finish all `GRPO_EPOCHS`): training continues\n", + " from that exact step via `resume_from_checkpoint`.\n", + "- **Fully complete** (already did all epochs): set `GRPO_FULLY_DONE = True`\n", + " below to skip GRPO entirely and load straight into DPO.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "85cb14bd", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:11:22.268987Z", + "iopub.status.busy": "2026-06-28T01:11:22.268692Z", + "iopub.status.idle": "2026-06-28T01:11:26.006499Z", + "shell.execute_reply": "2026-06-28T01:11:26.005492Z" + }, + "papermill": { + "duration": 3.774531, + "end_time": "2026-06-28T01:11:26.008186+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:22.233655+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# ===========================================================================\n", + "# RESUME FROM PREVIOUS GRPO RUN (cross-session checkpoint loading)\n", + "# ===========================================================================\n", + "# HOW TO USE:\n", + "# 1. Attach the previous session's Output/Dataset as an Input to this\n", + "# session (Add Input -> Notebook Output Files, or a Dataset built\n", + "# from it -- same as you did for the SFT resume).\n", + "# 2. Find the checkpoint path:\n", + "# !find /kaggle/input -maxdepth 6 -iname \"checkpoint-*\" -path \"*grpo*\" -type d\n", + "# 3a. If GRPO did NOT finish all GRPO_EPOCHS yet, set GRPO_RESUME_PATH to\n", + "# the highest checkpoint-N and leave GRPO_FULLY_DONE = False.\n", + "# Training resumes from that step and keeps going to GRPO_EPOCHS.\n", + "# 3b. If GRPO DID finish (you saw \"GRPO Training complete!\" printed in a\n", + "# prior session), set GRPO_FULLY_DONE = True instead -- this loads\n", + "# the final GRPO adapter weights and skips straight to DPO.\n", + "\n", + "GRPO_RESUME_PATH = \"/kaggle/input/notebooks/sandeepautomation/aftergrpo600/timps-coder-v4/grpo/checkpoint-648\" # <-- e.g. \"/kaggle/input//timps-coder-v4/grpo/checkpoint-600\"\n", + "GRPO_FULLY_DONE = True # <-- set True only if GRPO already completed all epochs\n", + "\n", + "if GRPO_FULLY_DONE:\n", + " if not GRPO_RESUME_PATH:\n", + " raise ValueError(\n", + " \"GRPO_FULLY_DONE=True requires GRPO_RESUME_PATH to point at the \"\n", + " \"final GRPO checkpoint so the trained weights can be loaded.\"\n", + " )\n", + " import os\n", + " if not os.path.isdir(GRPO_RESUME_PATH):\n", + " raise FileNotFoundError(\n", + " f\"GRPO_RESUME_PATH does not exist: {GRPO_RESUME_PATH}\\n\"\n", + " f\"Run: !find /kaggle/input -maxdepth 6 -iname 'checkpoint-*' -path '*grpo*' -type d\"\n", + " )\n", + " has_weights = (\n", + " os.path.isfile(f\"{GRPO_RESUME_PATH}/adapter_model.safetensors\")\n", + " or os.path.isfile(f\"{GRPO_RESUME_PATH}/adapter_model.bin\")\n", + " )\n", + " if not has_weights:\n", + " raise FileNotFoundError(\n", + " f\"No adapter weights found in {GRPO_RESUME_PATH}. \"\n", + " f\"Expected adapter_model.safetensors (GRPO was run with save_only_model=True).\"\n", + " )\n", + " print(f\"Loading COMPLETED GRPO adapter from: {GRPO_RESUME_PATH}\")\n", + " model.load_adapter(GRPO_RESUME_PATH, adapter_name=\"default\", is_trainable=True)\n", + " trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)\n", + " print(f\"GRPO weights loaded. Trainable params: {trainable:,}\")\n", + " print(f\"GRPO training will be SKIPPED -- proceeding straight to DPO.\")\n", + "elif GRPO_RESUME_PATH:\n", + " import os\n", + " if not os.path.isdir(GRPO_RESUME_PATH):\n", + " raise FileNotFoundError(\n", + " f\"GRPO_RESUME_PATH does not exist: {GRPO_RESUME_PATH}\\n\"\n", + " f\"Run: !find /kaggle/input -maxdepth 6 -iname 'checkpoint-*' -path '*grpo*' -type d\"\n", + " )\n", + " print(f\"Will resume mid-GRPO-training from: {GRPO_RESUME_PATH}\")\n", + " print(f\"(weights + optimizer-equivalent state load handled by resume_from_checkpoint\")\n", + " print(f\" inside the GRPOTrainer.train() call below)\")\n", + "else:\n", + " print(\"GRPO_RESUME_PATH not set -- GRPO will train from scratch in the next cell.\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bb4b663a", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:11:26.082559Z", + "iopub.status.busy": "2026-06-28T01:11:26.082183Z", + "iopub.status.idle": "2026-06-28T01:11:26.138920Z", + "shell.execute_reply": "2026-06-28T01:11:26.137854Z" + }, + "papermill": { + "duration": 0.095297, + "end_time": "2026-06-28T01:11:26.140488+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:26.045191+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import gc\n", + "from trl import GRPOConfig, GRPOTrainer\n", + "import numpy as np\n", + "import os, shutil, glob, torch\n", + "\n", + "# -- Cleanup any partial GRPO checkpoints from a previous run --\n", + "grpo_output = f\"{OUTPUT_DIR}/grpo\"\n", + "if os.path.isdir(grpo_output):\n", + " for ckpt in sorted(glob.glob(f\"{grpo_output}/checkpoint-*\")):\n", + " has_weights = glob.glob(f\"{ckpt}/*.safetensors\") or glob.glob(f\"{ckpt}/pytorch_model.bin\")\n", + " if not has_weights:\n", + " print(f\" Removing corrupted GRPO checkpoint: {ckpt}\")\n", + " shutil.rmtree(ckpt, ignore_errors=True)\n", + "\n", + "# -- AUTO-SCALED GRPO CONFIG --\n", + "# All the values below are read from the GPU-tier budget set in Step 1 (Cell 5).\n", + "# T4 (15 GB) gets the conservative profile; A100 keeps the original aggressive one.\n", + "# If you still hit OOM, the try/except at the bottom auto-retries with even\n", + "# smaller values.\n", + "\n", + "NUM_GENERATIONS = BUDGET_NUM_GENERATIONS # 2 on T4, 4 on A100\n", + "MAX_COMPLETION_LENGTH = BUDGET_MAX_COMPLETION_LEN # 512 on T4, 1024 on A100\n", + "MAX_PROMPT_LENGTH = BUDGET_MAX_PROMPT_LEN # 1536 on T4, 3072 on A100\n", + "GRPO_BATCH = BUDGET_GRPO_BATCH # 1 everywhere\n", + "GRPO_GRAD_ACCUM = BUDGET_GRPO_GRAD_ACCUM # 8 everywhere\n", + "GRPO_OPTIM = BUDGET_OPTIM # paged_adamw_8bit on T4, adamw_torch on A100\n", + "\n", + "# generation_batch_size MUST be a multiple of num_generations (TRL hard\n", + "# requirement). Derive it instead of hardcoding it.\n", + "def _round_up_to_multiple(value, multiple):\n", + " if multiple <= 0:\n", + " return value\n", + " remainder = value % multiple\n", + " return value if remainder == 0 else value + (multiple - remainder)\n", + "\n", + "GRPO_GENERATION_BATCH = _round_up_to_multiple(\n", + " GRPO_BATCH * GRPO_GRAD_ACCUM, NUM_GENERATIONS\n", + ")\n", + "assert GRPO_GENERATION_BATCH % NUM_GENERATIONS == 0, (\n", + " f\"generation_batch_size ({GRPO_GENERATION_BATCH}) must be divisible by \"\n", + " f\"num_generations ({NUM_GENERATIONS})\"\n", + ")\n", + "\n", + "grpo_config = GRPOConfig(\n", + " output_dir = grpo_output,\n", + " num_train_epochs = GRPO_EPOCHS, # 1 (fast) or 3 (full)\n", + " per_device_train_batch_size = GRPO_BATCH,\n", + " gradient_accumulation_steps = GRPO_GRAD_ACCUM,\n", + " learning_rate = 5e-6,\n", + " lr_scheduler_type = \"cosine\",\n", + " optim = GRPO_OPTIM, # paged_adamw_8bit = 8-bit + CPU paging\n", + " weight_decay = 0.01,\n", + " warmup_steps = 50,\n", + " logging_steps = 10,\n", + " save_steps = 200,\n", + " save_total_limit = 3,\n", + " save_only_model = True, # skip optimizer state at checkpoint\n", + " bf16 = torch.cuda.is_bf16_supported(),\n", + " fp16 = not torch.cuda.is_bf16_supported(),\n", + "\n", + " # GRPO-specific (the OOM-critical knobs)\n", + " num_generations = NUM_GENERATIONS,\n", + " max_completion_length = MAX_COMPLETION_LENGTH,\n", + " max_prompt_length = MAX_PROMPT_LENGTH, # explicit truncation -- REQUIRED\n", + " temperature = 0.7,\n", + " beta = 0.04,\n", + " loss_type = \"grpo\", # explicit; avoids bnpo surprise\n", + "\n", + " # Generation efficiency (cuts VRAM spikes during sample generation)\n", + " generation_batch_size = GRPO_GENERATION_BATCH, # derived: always a multiple of num_generations\n", + " # NOTE: do NOT set use_cache=False anywhere; default True is what makes\n", + " # KV-cache work and keeps generation memory bounded.\n", + "\n", + " # Reporting\n", + " report_to = \"none\",\n", + " seed = 42,\n", + " gradient_checkpointing = True,\n", + " gradient_checkpointing_kwargs = {\"use_reentrant\": False},\n", + " remove_unused_columns = False,\n", + ")\n", + "\n", + "print(f\"GRPO Config (auto-scaled for {GPU_TIER}):\")\n", + "print(f\" Num generations : {NUM_GENERATIONS}\")\n", + "print(f\" Generation batch : {GRPO_GENERATION_BATCH} (auto-derived, multiple of num_generations)\")\n", + "print(f\" Max completion : {MAX_COMPLETION_LENGTH} tokens\")\n", + "print(f\" Max prompt : {MAX_PROMPT_LENGTH} tokens\")\n", + "print(f\" Max length (sum) : {MAX_PROMPT_LENGTH + MAX_COMPLETION_LENGTH} tokens\")\n", + "print(f\" Temperature : 0.7\")\n", + "print(f\" KL penalty (beta) : 0.04\")\n", + "print(f\" Learning rate : 5e-6\")\n", + "print(f\" Optimizer : {GRPO_OPTIM}\")\n", + "print(f\" Epochs : {GRPO_EPOCHS}\")\n", + "print(f\" GRPO problems : {len(grpo_train):,}\")\n", + "print(f\" args class : {type(grpo_config).__name__}\")\n", + "print()\n", + "\n", + "\n", + "# -- Define reward functions for GRPOTrainer --\n", + "def grpo_correctness_reward(prompts, completions, **kwargs):\n", + " \"\"\"Reward code correctness based on test execution.\"\"\"\n", + " rewards = []\n", + " for completion in completions:\n", + " has_code = any(sig in completion for sig in [\"def \", \"class \", \"```python\", \"return \"])\n", + " has_verify = any(sig in completion.lower() for sig in [\"verify\", \"test\", \"assert\", \"check\"])\n", + " reward = 0.3 if has_code else 0.0\n", + " reward += 0.2 if has_verify else 0.0\n", + " rewards.append(reward)\n", + " return rewards\n", + "\n", + "\n", + "def grpo_discipline_reward(prompts, completions, **kwargs):\n", + " \"\"\"Reward for tool discipline -- inspecting before writing.\"\"\"\n", + " rewards = []\n", + " for completion in completions:\n", + " think_idx = completion.lower().find(\"think\")\n", + " inspect_idx = completion.lower().find(\"inspect\")\n", + " act_idx = completion.lower().find(\"act\")\n", + " read_idx = completion.lower().find(\"read_file\")\n", + "\n", + " inspected_first = False\n", + " if act_idx > 0:\n", + " if think_idx >= 0 and think_idx < act_idx:\n", + " inspected_first = True\n", + " if inspect_idx >= 0 and inspect_idx < act_idx:\n", + " inspected_first = True\n", + " if read_idx >= 0 and read_idx < act_idx:\n", + " inspected_first = True\n", + " elif think_idx >= 0 or inspect_idx >= 0 or read_idx >= 0:\n", + " inspected_first = True\n", + "\n", + " rewards.append(0.5 if inspected_first else 0.0)\n", + " return rewards\n", + "\n", + "\n", + "def grpo_verification_reward(prompts, completions, **kwargs):\n", + " \"\"\"Reward for verification after writing code.\"\"\"\n", + " rewards = []\n", + " for completion in completions:\n", + " act_idx = completion.lower().rfind(\"act\")\n", + " verify_idx = completion.lower().rfind(\"verify\")\n", + " test_idx = completion.lower().rfind(\"run_tests\")\n", + "\n", + " verified_after = False\n", + " if act_idx >= 0:\n", + " if verify_idx > act_idx or test_idx > act_idx:\n", + " verified_after = True\n", + " elif verify_idx >= 0 or test_idx >= 0:\n", + " verified_after = True\n", + "\n", + " rewards.append(0.3 if verified_after else 0.0)\n", + " return rewards\n", + "\n", + "\n", + "# ===========================================================================\n", + "# SKIP GRPO ENTIRELY IF IT ALREADY FULLY COMPLETED IN A PRIOR SESSION\n", + "# ===========================================================================\n", + "# GRPO_FULLY_DONE / GRPO_RESUME_PATH are set by the \"Resume Point\" cell above.\n", + "if GRPO_FULLY_DONE:\n", + " print(\"=\" * 50)\n", + " print(\"GRPO_FULLY_DONE = True -- skipping GRPO training.\")\n", + " print(\"Using the GRPO adapter weights loaded from GRPO_RESUME_PATH.\")\n", + " print(\"=\" * 50)\n", + " grpo_stats = None\n", + "else:\n", + " # -- Create GRPO Trainer --\n", + " print(\"Initializing GRPO Trainer...\")\n", + " print(\" This uses the SFT-warmed model as the starting policy\")\n", + "\n", + " # Free any remaining slack right before trainer init\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + " grpo_trainer = GRPOTrainer(\n", + " model = model,\n", + " args = grpo_config,\n", + " train_dataset = grpo_train,\n", + " reward_funcs = [\n", + " grpo_correctness_reward,\n", + " grpo_discipline_reward,\n", + " grpo_verification_reward,\n", + " ],\n", + " processing_class = tokenizer,\n", + " )\n", + "\n", + " print(\"\\nStarting GRPO Training...\")\n", + " print(f\" This is the longest training step (~1-2h on T4 per epoch)\")\n", + " if GRPO_RESUME_PATH:\n", + " print(f\" Resuming mid-training from: {GRPO_RESUME_PATH}\")\n", + " print(\"=\" * 60)\n", + "\n", + " try:\n", + " grpo_stats = grpo_trainer.train(\n", + " resume_from_checkpoint=GRPO_RESUME_PATH if GRPO_RESUME_PATH else None\n", + " )\n", + " except torch.cuda.OutOfMemoryError as e:\n", + " print(f\"\\n!! GRPO OOM even with the conservative T4 profile: {e}\")\n", + " print(\" Auto-retrying with the EMERGENCY profile:\")\n", + " print(\" NUM_GENERATIONS = 1 (degenerate GRPO -> REINFORCE; still useful)\")\n", + " print(\" MAX_COMPLETION = 256\")\n", + " print(\" MAX_PROMPT = 1024\")\n", + "\n", + " # Free everything from the failed attempt\n", + " del grpo_trainer\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + " # Rebuild config with the emergency profile\n", + " grpo_config.num_generations = 1\n", + " grpo_config.max_completion_length = 256\n", + " grpo_config.max_prompt_length = 1024\n", + " # Re-derive generation_batch_size for the NEW num_generations so this\n", + " # can never hit the same \"must be divisible by\" error.\n", + " grpo_config.generation_batch_size = _round_up_to_multiple(\n", + " GRPO_BATCH * GRPO_GRAD_ACCUM, grpo_config.num_generations\n", + " )\n", + " print(f\" Generation batch = {grpo_config.generation_batch_size} (re-derived for emergency profile)\")\n", + "\n", + " grpo_trainer = GRPOTrainer(\n", + " model = model,\n", + " args = grpo_config,\n", + " train_dataset = grpo_train,\n", + " reward_funcs = [\n", + " grpo_correctness_reward,\n", + " grpo_discipline_reward,\n", + " grpo_verification_reward,\n", + " ],\n", + " processing_class = tokenizer,\n", + " )\n", + " # NOTE: emergency profile changed config shape (num_generations etc.),\n", + " # so a checkpoint saved under the original profile is generally not\n", + " # safely resumable here -- start the emergency attempt fresh unless\n", + " # you know the saved checkpoint matches this exact emergency shape.\n", + " grpo_stats = grpo_trainer.train()\n", + "\n", + " print(\"=\" * 60)\n", + " if grpo_stats is not None:\n", + " print(f\"GRPO Training complete!\")\n", + " print(f\" Train loss : {grpo_stats.training_loss:.4f}\")\n", + " print(f\" Total steps : {grpo_stats.global_step}\")\n", + " runtime_mins = grpo_stats.metrics.get('train_runtime', 0) / 60\n", + " print(f\" Runtime : {runtime_mins:.1f} minutes\")\n", + " else:\n", + " print(\"GRPO training did not complete -- check the error above.\")\n", + " raise RuntimeError(\"GRPO training failed even with the emergency profile\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "f5c273b7", + "metadata": { + "papermill": { + "duration": 0.034225, + "end_time": "2026-06-28T01:11:26.209394+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:26.175169+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 4: STEP 3 — DPO ALIGNMENT\n", + "\n", + "After GRPO, we use Direct Preference Optimization (DPO) to refine the model's outputs.\n", + "\n", + "**Why DPO after GRPO?**\n", + "- GRPO explores and finds good behaviors\n", + "- DPO consolidates those behaviors by learning from preference pairs\n", + "- The combination (GRPO → DPO) is more effective than either alone\n", + "\n", + "**Process:**\n", + "1. Generate 2 solutions per problem with the GRPO-trained model\n", + "2. Score each using our reward functions\n", + "3. Higher-scored = \"chosen\", lower = \"rejected\"\n", + "4. Train DPO on these preference pairs\n", + "\n", + "**Kaggle note:** DPO_NUM_PAIRS is set in Step 0 (100 fast / 200 full).\n" + ] + }, + { + "cell_type": "markdown", + "id": "33487a15", + "metadata": { + "papermill": { + "duration": 0.034795, + "end_time": "2026-06-28T01:11:26.278408+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:26.243613+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 11 — Generate DPO preference pairs\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "53f4f9a9", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T01:11:26.347983Z", + "iopub.status.busy": "2026-06-28T01:11:26.347634Z", + "iopub.status.idle": "2026-06-28T03:30:45.164532Z", + "shell.execute_reply": "2026-06-28T03:30:45.163531Z" + }, + "papermill": { + "duration": 8358.854286, + "end_time": "2026-06-28T03:30:45.166171+00:00", + "exception": false, + "start_time": "2026-06-28T01:11:26.311885+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import gc\n", + "from tqdm import tqdm\n", + "import torch\n", + "\n", + "# ── OOM RECOVERY: free everything from GRPO before generating DPO pairs ────\n", + "# DPO pair gen runs N×2 sequential generate() calls. Each one is small in\n", + "# isolation, but fragmentation builds up over hundreds of calls. Start clean.\n", + "try:\n", + " del grpo_trainer\n", + " print(\"Deleted grpo_trainer\")\n", + "except NameError:\n", + " print(\"grpo_trainer already gone (ok if you skipped GRPO)\")\n", + "\n", + "# Drop large intermediates we no longer need\n", + "for _name in (\"grpo_config\", \"grpo_stats\"):\n", + " try:\n", + " globals().pop(_name, None)\n", + " except Exception:\n", + " pass\n", + "\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n", + "\n", + "# -- Generate preference pairs --\n", + "# For each problem, generate 2 completions and score them\n", + "# The higher-scored one becomes \"chosen\", the lower becomes \"rejected\"\n", + "\n", + "# Use the budget-aware completion length (512 on T4, 1024 on A100)\n", + "DPO_GEN_MAX_NEW = BUDGET_MAX_COMPLETION_LEN\n", + "\n", + "print(\"Generating DPO preference pairs...\")\n", + "print(f\" Using the GRPO-trained model to create chosen/rejected pairs\")\n", + "print(f\" Target pair count: {DPO_NUM_PAIRS}\")\n", + "print(f\" Max new tokens per completion: {DPO_GEN_MAX_NEW}\")\n", + "\n", + "dpo_data = []\n", + "num_pairs = min(DPO_NUM_PAIRS, len(grpo_train))\n", + "sample_indices = random.sample(range(len(grpo_train)), num_pairs)\n", + "\n", + "FastLanguageModel.for_inference(model) # Switch to inference mode\n", + "\n", + "for idx in tqdm(sample_indices, desc=\"Generating pairs\"):\n", + " problem = grpo_train[idx]\n", + " prompt = problem[\"prompt\"]\n", + "\n", + " # Format prompt in ChatML\n", + " messages = [\n", + " {\"role\": \"system\", \"content\": SYSTEM_V4},\n", + " {\"role\": \"user\", \"content\": prompt},\n", + " ]\n", + " input_text = tokenizer.apply_chat_template(\n", + " messages, tokenize=False, add_generation_prompt=True\n", + " )\n", + " inputs = tokenizer(input_text, return_tensors=\"pt\").to(model.device)\n", + "\n", + " # Generate 2 completions with different temperatures\n", + " completions = []\n", + " for temp in [0.3, 0.8]: # Low and high temperature for diversity\n", + " with torch.no_grad():\n", + " outputs = model.generate(\n", + " **inputs,\n", + " max_new_tokens=DPO_GEN_MAX_NEW,\n", + " temperature=temp,\n", + " do_sample=True,\n", + " top_p=0.95,\n", + " pad_token_id=tokenizer.pad_token_id,\n", + " )\n", + " completion = tokenizer.decode(\n", + " outputs[0][inputs[\"input_ids\"].shape[1]:],\n", + " skip_special_tokens=True\n", + " )\n", + " completions.append(completion)\n", + " # Free this generation's tensors immediately — prevents fragmentation\n", + " # buildup across the hundreds of generate() calls in this loop.\n", + " del outputs\n", + " torch.cuda.empty_cache()\n", + "\n", + " # Score completions\n", + " scores = []\n", + " for comp in completions:\n", + " r_correct = grpo_correctness_reward([prompt], [comp])[0]\n", + " r_discipline = grpo_discipline_reward([prompt], [comp])[0]\n", + " r_verify = grpo_verification_reward([prompt], [comp])[0]\n", + " total = 0.5 * r_correct + 0.3 * r_discipline + 0.2 * r_verify\n", + " scores.append(total)\n", + "\n", + " # Higher score = chosen, lower = rejected\n", + " if scores[0] >= scores[1]:\n", + " chosen, rejected = completions[0], completions[1]\n", + " else:\n", + " chosen, rejected = completions[1], completions[0]\n", + "\n", + " # Skip if both are equally bad\n", + " if max(scores) < 0.1:\n", + " continue\n", + "\n", + " dpo_data.append({\n", + " \"prompt\": input_text,\n", + " \"chosen\": chosen,\n", + " \"rejected\": rejected,\n", + " \"chosen_score\": max(scores),\n", + " \"rejected_score\": min(scores),\n", + " })\n", + "\n", + " # Drop per-iteration tensors\n", + " del inputs, completions\n", + " # Every 25 iterations, force a deeper clean\n", + " if len(dpo_data) % 25 == 0:\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + "# Create DPO dataset\n", + "from datasets import Dataset as HFDataset\n", + "dpo_dataset = HFDataset.from_list(dpo_data)\n", + "\n", + "# Persist to /kaggle/working so it survives a session restart\n", + "import json\n", + "with open(f\"{WORK_DIR}/dpo_pairs.json\", \"w\") as f:\n", + " json.dump(dpo_data, f)\n", + "\n", + "print(f\"\\nGenerated {len(dpo_data)} DPO preference pairs\")\n", + "print(f\" Avg chosen score : {np.mean([d['chosen_score'] for d in dpo_data]):.3f}\")\n", + "print(f\" Avg rejected score: {np.mean([d['rejected_score'] for d in dpo_data]):.3f}\")\n", + "print(f\" Avg score gap : {np.mean([d['chosen_score'] - d['rejected_score'] for d in dpo_data]):.3f}\")\n", + "print(f\" Saved to {WORK_DIR}/dpo_pairs.json\")\n", + "\n", + "# Final cleanup before DPO training cell\n", + "del dpo_data, sample_indices\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n" + ] + }, + { + "cell_type": "markdown", + "id": "9f09d756", + "metadata": { + "papermill": { + "duration": 0.055752, + "end_time": "2026-06-28T03:30:45.279135+00:00", + "exception": false, + "start_time": "2026-06-28T03:30:45.223383+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 12 — DPO Training (preference alignment)\n" + ] + }, + { + "cell_type": "markdown", + "id": "14805394", + "metadata": { + "papermill": { + "duration": 0.055854, + "end_time": "2026-06-28T03:30:45.390364+00:00", + "exception": false, + "start_time": "2026-06-28T03:30:45.334510+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# Resume Point — Load Previous DPO Checkpoint (cross-session)\n", + "\n", + "DPO checkpoints every `save_steps=100` to `{OUTPUT_DIR}/dpo/checkpoint-N`.\n", + "Same pattern as SFT and GRPO: attach the previous session's Output as an\n", + "Input, then point `DPO_RESUME_PATH` at the highest checkpoint you have.\n", + "\n", + "- **Mid-training**: leave `DPO_FULLY_DONE = False`, training continues from\n", + " that step via `resume_from_checkpoint`.\n", + "- **Fully complete** (DPO already finished its 1 epoch in a prior session):\n", + " set `DPO_FULLY_DONE = True` to load the final weights and skip straight\n", + " to the post-training steps (HumanEval, fusing, GGUF export, etc.).\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "be9ae859", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T03:30:45.503320Z", + "iopub.status.busy": "2026-06-28T03:30:45.502743Z", + "iopub.status.idle": "2026-06-28T03:30:50.696622Z", + "shell.execute_reply": "2026-06-28T03:30:50.695711Z" + }, + "papermill": { + "duration": 5.251945, + "end_time": "2026-06-28T03:30:50.698062+00:00", + "exception": false, + "start_time": "2026-06-28T03:30:45.446117+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# ===========================================================================\n", + "# RESUME FROM PREVIOUS DPO RUN (cross-session checkpoint loading)\n", + "# ===========================================================================\n", + "# 1. Attach the previous session's Output/Dataset as an Input.\n", + "# 2. Find the checkpoint path:\n", + "# !find /kaggle/input -maxdepth 6 -iname \"checkpoint-*\" -path \"*dpo*\" -type d\n", + "# 3a. Mid-training: set DPO_RESUME_PATH to the highest checkpoint-N,\n", + "# leave DPO_FULLY_DONE = False.\n", + "# 3b. Fully done: set DPO_FULLY_DONE = True to load final weights and\n", + "# skip DPO training entirely.\n", + "\n", + "DPO_RESUME_PATH = \"/kaggle/input/notebooks/sandeepautomation/aftergrpo600/timps-coder-v4/dpo/checkpoint-50\" # <-- e.g. \"/kaggle/input//timps-coder-v4/dpo/checkpoint-100\"\n", + "DPO_FULLY_DONE = True # <-- set True only if DPO already completed its epoch\n", + "\n", + "if DPO_FULLY_DONE:\n", + " if not DPO_RESUME_PATH:\n", + " raise ValueError(\n", + " \"DPO_FULLY_DONE=True requires DPO_RESUME_PATH to point at the \"\n", + " \"final DPO checkpoint so the trained weights can be loaded.\"\n", + " )\n", + " import os\n", + " if not os.path.isdir(DPO_RESUME_PATH):\n", + " raise FileNotFoundError(\n", + " f\"DPO_RESUME_PATH does not exist: {DPO_RESUME_PATH}\\n\"\n", + " f\"Run: !find /kaggle/input -maxdepth 6 -iname 'checkpoint-*' -path '*dpo*' -type d\"\n", + " )\n", + " has_weights = (\n", + " os.path.isfile(f\"{DPO_RESUME_PATH}/adapter_model.safetensors\")\n", + " or os.path.isfile(f\"{DPO_RESUME_PATH}/adapter_model.bin\")\n", + " )\n", + " if not has_weights:\n", + " raise FileNotFoundError(\n", + " f\"No adapter weights found in {DPO_RESUME_PATH}. \"\n", + " f\"Expected adapter_model.safetensors (DPO was run with save_only_model=True).\"\n", + " )\n", + " print(f\"Loading COMPLETED DPO adapter from: {DPO_RESUME_PATH}\")\n", + " model.load_adapter(DPO_RESUME_PATH, adapter_name=\"default\", is_trainable=True)\n", + " trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)\n", + " print(f\"DPO weights loaded. Trainable params: {trainable:,}\")\n", + " print(f\"DPO training will be SKIPPED -- proceeding to evaluation / export.\")\n", + "elif DPO_RESUME_PATH:\n", + " import os\n", + " if not os.path.isdir(DPO_RESUME_PATH):\n", + " raise FileNotFoundError(\n", + " f\"DPO_RESUME_PATH does not exist: {DPO_RESUME_PATH}\\n\"\n", + " f\"Run: !find /kaggle/input -maxdepth 6 -iname 'checkpoint-*' -path '*dpo*' -type d\"\n", + " )\n", + " print(f\"Will resume mid-DPO-training from: {DPO_RESUME_PATH}\")\n", + "else:\n", + " print(\"DPO_RESUME_PATH not set -- DPO will train from scratch in the next cell.\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0ac12c9", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T03:30:50.813427Z", + "iopub.status.busy": "2026-06-28T03:30:50.812942Z", + "iopub.status.idle": "2026-06-28T03:30:51.640596Z", + "shell.execute_reply": "2026-06-28T03:30:51.639400Z" + }, + "papermill": { + "duration": 0.886642, + "end_time": "2026-06-28T03:30:51.642174+00:00", + "exception": false, + "start_time": "2026-06-28T03:30:50.755532+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import gc\n", + "from trl import DPOConfig, DPOTrainer\n", + "import os, shutil, glob, torch\n", + "\n", + "# -- OOM RECOVERY: free pair-gen intermediates before DPOTrainer init --\n", + "# DPO holds the policy + a frozen reference policy in memory simultaneously,\n", + "# so it has the highest steady-state VRAM usage of any training step.\n", + "for _name in (\"grpo_correctness_reward\", \"grpo_discipline_reward\", \"grpo_verification_reward\"):\n", + " # Keep these -- DPOTrainer doesn't need them but the next SGS cell might.\n", + " pass\n", + "\n", + "# Drop anything else we can\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n", + "\n", + "# -- DPO Config (auto-scaled by GPU tier) --\n", + "# DPO uses a much lower learning rate than SFT/GRPO.\n", + "# We're fine-tuning preferences, not learning from scratch.\n", + "FastLanguageModel.for_training(model) # Switch back to training mode\n", + "\n", + "# Cleanup any partial DPO checkpoints from a previous run\n", + "dpo_output = f\"{OUTPUT_DIR}/dpo\"\n", + "if os.path.isdir(dpo_output):\n", + " for ckpt in sorted(glob.glob(f\"{dpo_output}/checkpoint-*\")):\n", + " has_weights = glob.glob(f\"{ckpt}/*.safetensors\") or glob.glob(f\"{ckpt}/pytorch_model.bin\")\n", + " if not has_weights:\n", + " print(f\" Removing corrupted DPO checkpoint: {ckpt}\")\n", + " shutil.rmtree(ckpt, ignore_errors=True)\n", + "\n", + "# Budget-aware knobs (read from globals set in Step 1 / Cell 5)\n", + "DPO_MAX_LENGTH = min(MAX_SEQ_LEN, BUDGET_MAX_PROMPT_LEN + BUDGET_MAX_COMPLETION_LEN)\n", + "DPO_MAX_PROMPT = BUDGET_MAX_PROMPT_LEN\n", + "DPO_MAX_COMPLETION = BUDGET_MAX_COMPLETION_LEN\n", + "DPO_OPTIM = BUDGET_OPTIM # paged_adamw_8bit on T4, adamw_torch on A100\n", + "\n", + "dpo_config = DPOConfig(\n", + " output_dir = dpo_output,\n", + " num_train_epochs = 1,\n", + " per_device_train_batch_size = 1,\n", + " gradient_accumulation_steps = 4,\n", + " learning_rate = 1e-6,\n", + " lr_scheduler_type = \"cosine\",\n", + " optim = DPO_OPTIM, # 8-bit + CPU paging on T4\n", + " weight_decay = 0.01,\n", + " warmup_steps = 20,\n", + " bf16 = torch.cuda.is_bf16_supported(),\n", + " fp16 = not torch.cuda.is_bf16_supported(),\n", + " beta = 0.1, # preference strength\n", + " max_length = DPO_MAX_LENGTH, # cap total sequence length\n", + " max_prompt_length = DPO_MAX_PROMPT, # explicit prompt truncation\n", + " max_completion_length = DPO_MAX_COMPLETION,\n", + " logging_steps = 10,\n", + " save_steps = 100,\n", + " save_total_limit = 2,\n", + " save_only_model = True, # skip optimizer state at checkpoint\n", + " report_to = \"none\",\n", + " seed = 42,\n", + " gradient_checkpointing = True,\n", + " gradient_checkpointing_kwargs = {\"use_reentrant\": False},\n", + " remove_unused_columns = False,\n", + ")\n", + "\n", + "print(f\"DPO Config (auto-scaled for {GPU_TIER}):\")\n", + "print(f\" Learning rate : 1e-6 (very low for preference tuning)\")\n", + "print(f\" Beta : 0.1 (preference strength)\")\n", + "print(f\" Optimizer : {DPO_OPTIM}\")\n", + "print(f\" Max length : {DPO_MAX_LENGTH}\")\n", + "print(f\" Max prompt : {DPO_MAX_PROMPT}\")\n", + "print(f\" Max completion : {DPO_MAX_COMPLETION}\")\n", + "print(f\" Epochs : 1\")\n", + "print(f\" Preference pairs : {len(dpo_dataset)}\")\n", + "print(f\" args class : {type(dpo_config).__name__}\")\n", + "print()\n", + "\n", + "# ===========================================================================\n", + "# SKIP DPO ENTIRELY IF IT ALREADY FULLY COMPLETED IN A PRIOR SESSION\n", + "# ===========================================================================\n", + "# DPO_FULLY_DONE / DPO_RESUME_PATH are set by the \"Resume Point\" cell above.\n", + "if DPO_FULLY_DONE:\n", + " print(\"=\" * 50)\n", + " print(\"DPO_FULLY_DONE = True -- skipping DPO training.\")\n", + " print(\"Using the DPO adapter weights loaded from DPO_RESUME_PATH.\")\n", + " print(\"=\" * 50)\n", + " dpo_stats = None\n", + "else:\n", + " # Final cleanup right before trainer init\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + " dpo_trainer = DPOTrainer(\n", + " model = model,\n", + " args = dpo_config,\n", + " train_dataset = dpo_dataset,\n", + " processing_class = tokenizer,\n", + " )\n", + "\n", + " print(\"Starting DPO Training...\")\n", + " if DPO_RESUME_PATH:\n", + " print(f\" Resuming mid-training from: {DPO_RESUME_PATH}\")\n", + " print(\"=\" * 50)\n", + "\n", + " dpo_stats = None\n", + " try:\n", + " dpo_stats = dpo_trainer.train(\n", + " resume_from_checkpoint=DPO_RESUME_PATH if DPO_RESUME_PATH else None\n", + " )\n", + " except torch.cuda.OutOfMemoryError as e:\n", + " print(f\"\\n!! DPO OOM: {e}\")\n", + " print(\" Auto-retrying with EMERGENCY profile:\")\n", + " print(\" max_length = 1024\")\n", + " print(\" max_prompt = 768\")\n", + " print(\" max_completion = 256\")\n", + "\n", + " del dpo_trainer\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + " dpo_config.max_length = 1024\n", + " dpo_config.max_prompt_length = 768\n", + " dpo_config.max_completion_length = 256\n", + "\n", + " dpo_trainer = DPOTrainer(\n", + " model = model,\n", + " args = dpo_config,\n", + " train_dataset = dpo_dataset,\n", + " processing_class = tokenizer,\n", + " )\n", + " # NOTE: emergency profile changed config shape, so a checkpoint saved\n", + " # under the original profile is generally not safely resumable here.\n", + " dpo_stats = dpo_trainer.train()\n", + "\n", + " print(\"=\" * 50)\n", + " if dpo_stats is not None:\n", + " print(f\"DPO Training complete!\")\n", + " print(f\" Train loss : {dpo_stats.training_loss:.4f}\")\n", + " print(f\" Total steps : {dpo_stats.global_step}\")\n", + " runtime_mins = dpo_stats.metrics.get('train_runtime', 0) / 60\n", + " print(f\" Runtime : {runtime_mins:.1f} minutes\")\n", + " else:\n", + " print(\"DPO training did not complete -- check the error above.\")\n", + " raise RuntimeError(\"DPO training failed even with the emergency profile\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "3331a1d3", + "metadata": { + "papermill": { + "duration": 0.05501, + "end_time": "2026-06-28T03:30:51.755725+00:00", + "exception": false, + "start_time": "2026-06-28T03:30:51.700715+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 5: STEP 4 — SGS SELF-PLAY\n", + "\n", + "Based on arXiv 2604.20209v1: **Self-Guided Self-Play for Theorem Proving**\n", + "\n", + "In the paper, a 7B model beat a 671B model using self-play with 3 roles:\n", + "- **Solver**: Solves problems (updated with REINFORCE)\n", + "- **Conjecturer**: Generates simpler sub-problems from hard ones\n", + "- **Guide**: Scores problem quality on 3 dimensions\n", + "\n", + "We adapt this from theorem proving → code generation:\n", + "- In theorem proving, the verifier is the Lean compiler\n", + "- In coding, the verifier is the test suite + linter\n", + "\n", + "**Kaggle T4 note:** `SGS_NUM_ROUNDS` and `SGS_K_PER_ROUND` are configured in Step 0.\n", + "The full paper uses 50 rounds × 8 attempts — on Kaggle T4 we run 10 rounds × 4 attempts to fit\n", + "inside the 12-hour session budget. Quality is still meaningful; you can scale up if you have\n", + "multiple sessions available.\n" + ] + }, + { + "cell_type": "markdown", + "id": "aef4f974", + "metadata": {}, + "source": [ + "# @title Step 13 — Implement SGS Roles (FIXED v2: real code execution + memory-safe REINFORCE)\n", + "\n", + "**v2 fixes an OOM crash from v1.** v1 fixed the \"no gradients\" and \"no real\n", + "tests\" bugs, but introduced a new one: it ran a full-sequence second forward\n", + "pass (to get differentiable log-probs) that held the entire activation graph\n", + "in memory at once, alongside the model + leftover KV cache from generation.\n", + "On a T4 (14.56GB) with a 7B model in 4-bit + LoRA, that's a guaranteed OOM —\n", + "which is exactly what happened 20 seconds into Round 1.\n", + "\n", + "**v2 changes:**\n", + "- Generation (no-grad, uses KV cache) and scoring (grad-enabled) are now\n", + " fully separate phases — generation tensors are explicitly deleted and\n", + " `torch.cuda.empty_cache()` is called BEFORE the scoring pass starts, so\n", + " the two phases never hold memory simultaneously.\n", + "- `gradient_checkpointing_enable()` is turned on for the scoring pass,\n", + " trading compute for memory.\n", + "- The scoring pass runs under `torch.autocast(..., dtype=torch.bfloat16)`\n", + " instead of upcasting the whole sequence to fp32 logits at once.\n", + "- Log-prob gather is chunked along the sequence dimension so the softmax/\n", + " gather intermediate never covers the full sequence at once.\n", + "- `torch.cuda.empty_cache()` now runs after every sample AND every problem,\n", + " not just every problem.\n", + "- Default `max_solution_tokens` lowered from 512 → 256 (also lowered in the\n", + " run cell) since shorter sequences directly reduce the scoring pass's\n", + " peak memory. Raise it back once you confirm stability.\n", + "\n", + "If you still see OOM after this, the next lever is dropping `k` (solutions\n", + "per round) or `SGS_TARGET_PROBLEMS`/`SGS_NUM_ROUNDS` in Step 0.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "677d81f7", + "metadata": {}, + "outputs": [], + "source": [ + "import os, re, gc, json, subprocess, sys\n", + "import numpy as np\n", + "import torch\n", + "import torch.nn.functional as F\n", + "from typing import List, Dict, Optional\n", + "\n", + "\n", + "def extract_code(text: str) -> Optional[str]:\n", + " \"\"\"Pull the first ```python ... ``` fenced block out of model output.\n", + " Falls back to a bare ``` block, then to None (no code found).\"\"\"\n", + " m = re.search(r\"```python\\s*\\n(.*?)```\", text, re.DOTALL)\n", + " if m:\n", + " return m.group(1).strip()\n", + " m = re.search(r\"```\\s*\\n(.*?)```\", text, re.DOTALL)\n", + " if m:\n", + " return m.group(1).strip()\n", + " return None\n", + "\n", + "\n", + "class FixedCodeQAEnvironment:\n", + " \"\"\"Same interface as CodeQAEnvironment.run_tests, but actually writes\n", + " a runnable test file before invoking pytest.\"\"\"\n", + "\n", + " def __init__(self, workspace_dir=\"/kaggle/working/sgs_workspace\"):\n", + " self.workspace = workspace_dir\n", + " os.makedirs(workspace_dir, exist_ok=True)\n", + " self.tool_history = []\n", + "\n", + " def reset(self):\n", + " self.tool_history = []\n", + " import shutil\n", + " shutil.rmtree(self.workspace, ignore_errors=True)\n", + " os.makedirs(self.workspace, exist_ok=True)\n", + "\n", + " def write_file(self, filepath, content):\n", + " full_path = os.path.join(self.workspace, filepath)\n", + " os.makedirs(os.path.dirname(full_path) or \".\", exist_ok=True)\n", + " with open(full_path, \"w\") as f:\n", + " f.write(content)\n", + " self.tool_history.append({\"tool\": \"write_file\", \"path\": filepath, \"success\": True})\n", + "\n", + " def run_solution(self, code: str, problem: Dict, timeout=15) -> Dict:\n", + " \"\"\"Actually execute `code` against the problem's real tests.\n", + "\n", + " Handles two schemas seen in grpo_problems.json:\n", + " - HumanEval-style: test_cases is a `def check(candidate): ...`\n", + " block plus an entry_point naming the function to test.\n", + " - MBPP-style: test_cases is a newline-joined list of bare\n", + " `assert ...` statements that call the function directly.\n", + " - Empty test_cases (SWE-bench/LeetCode/agentic): fall back to a\n", + " smoke test — does the code at least parse and execute without\n", + " raising, since we don't have oracle tests for these sources.\n", + " \"\"\"\n", + " self.reset()\n", + " test_cases = (problem.get(\"test_cases\") or \"\").strip()\n", + " entry_point = problem.get(\"entry_point\", \"\")\n", + "\n", + " if not code:\n", + " return {\"passed\": False, \"reason\": \"no_code_extracted\"}\n", + "\n", + " if test_cases and entry_point:\n", + " harness = f\"{code}\\n\\n{test_cases}\\n\\ncheck({entry_point})\\n\"\n", + " elif test_cases:\n", + " harness = f\"{code}\\n\\n{test_cases}\\n\"\n", + " else:\n", + " harness = f\"{code}\\n\"\n", + "\n", + " self.write_file(\"run_solution.py\", harness)\n", + " try:\n", + " # CRITICAL: this subprocess runs LLM-GENERATED code we don't\n", + " # control. It uses sys.executable, which is the SAME Python\n", + " # binary the Kaggle kernel runs -- meaning torch/unsloth/cuda\n", + " # are all importable inside it. Without env restriction, this\n", + " # subprocess inherits CUDA_VISIBLE_DEVICES and can attach its\n", + " # own CUDA context to the SAME GPU the training process is\n", + " # using. If any generated \"solution\" imports torch (which\n", + " # happens -- models asked to write code sometimes reach for\n", + " # ML libraries out of habit), that subprocess claims real VRAM\n", + " # via its own context (~300-500MB of context overhead alone),\n", + " # and on timeout it gets SIGKILLed rather than cleanly shut\n", + " # down, which does not always release that VRAM immediately.\n", + " # Over hundreds of subprocess launches (k solves x N problems\n", + " # x rounds), this is a very plausible source of the ~7.6GB gap\n", + " # between what PyTorch reports as reserved and what nvidia-smi\n", + " # reports as actually free during SGS.\n", + " #\n", + " # Fix: explicitly hide the GPU from every sandboxed subprocess.\n", + " # Candidate code has no legitimate reason to touch CUDA to pass\n", + " # a HumanEval/MBPP-style correctness check, so this costs\n", + " # nothing functionally and closes off the leak at the source.\n", + " _sandbox_env = os.environ.copy()\n", + " _sandbox_env[\"CUDA_VISIBLE_DEVICES\"] = \"\"\n", + " result = subprocess.run(\n", + " [sys.executable, os.path.join(self.workspace, \"run_solution.py\")],\n", + " capture_output=True, text=True, timeout=timeout,\n", + " env=_sandbox_env,\n", + " )\n", + " passed = result.returncode == 0\n", + " return {\n", + " \"passed\": passed,\n", + " \"stdout\": result.stdout[-1000:],\n", + " \"stderr\": result.stderr[-1000:],\n", + " \"smoke_only\": not bool(test_cases),\n", + " }\n", + " except subprocess.TimeoutExpired:\n", + " return {\"passed\": False, \"reason\": \"timeout\", \"smoke_only\": not bool(test_cases)}\n", + " except Exception as e:\n", + " return {\"passed\": False, \"reason\": str(e), \"smoke_only\": not bool(test_cases)}\n", + "\n", + " def compute_tool_discipline_reward(self):\n", + " return 0.1\n", + "\n", + "\n", + "class RealSGSTrainer:\n", + " \"\"\"SGS self-play with actual policy-gradient (REINFORCE) updates.\n", + "\n", + " v2 — memory-safe on T4 (14-16GB):\n", + " The v1 bug: generate_with_grad() ran model.generate() (no_grad, cheap)\n", + " and THEN a second full forward pass over the entire sequence just to\n", + " get differentiable log-probs. That second pass holds the ENTIRE\n", + " activation graph for a ~512-1024 token sequence in memory simultaneously\n", + " with the model weights + KV cache fragments left over from generation\n", + " -> guaranteed OOM on a 14.56GB T4 for a 7B-in-4bit + LoRA model.\n", + "\n", + " v2 fix:\n", + " - Never do a full-sequence second forward pass. Instead, score log-probs\n", + " in small chunks (chunked_forward) so only one chunk's activations are\n", + " live at a time, and immediately free each chunk's graph after\n", + " extracting the (small) per-token logprob scalars we need.\n", + " - Explicitly delete `gen_out` / logits / the KV cache after generation,\n", + " before scoring, so the two phases don't overlap in memory.\n", + " - Reduced default max_solution_tokens and added a hidden micro-batch\n", + " of 1 (already true) plus torch.cuda.empty_cache() between EVERY\n", + " problem and EVERY sample, not just every problem.\n", + " - Relies on Unsloth's own gradient checkpointing (enabled once, at\n", + " LoRA setup time, via use_gradient_checkpointing=\"unsloth\") for the\n", + " scoring forward pass. Does NOT re-call the generic HF\n", + " gradient_checkpointing_enable() here -- doing so previously reset\n", + " Unsloth's patched checkpointing to a vanilla version that silently\n", + " stopped saving memory, which is what caused near-total VRAM\n", + " exhaustion (14.5/14.56 GiB used) by the first couple of problems\n", + " in a round.\n", + " \"\"\"\n", + "\n", + " def __init__(self, model, tokenizer, target_problems,\n", + " num_rounds=5, k_solves_per_round=2,\n", + " max_solution_tokens=256,\n", + " score_chunk_size=64,\n", + " lr=1e-5, save_every=1,\n", + " output_dir=\"/kaggle/working/sgs_checkpoints\",\n", + " system_prompt=\"\"):\n", + " self.model = model\n", + " self.tokenizer = tokenizer\n", + " self.target_problems = target_problems\n", + " self.num_rounds = num_rounds\n", + " self.k = k_solves_per_round\n", + " self.max_solution_tokens = max_solution_tokens\n", + " self.score_chunk_size = score_chunk_size\n", + " self.env = FixedCodeQAEnvironment()\n", + " self.solve_rates = {}\n", + " self.all_results = []\n", + " self.output_dir = output_dir\n", + " os.makedirs(output_dir, exist_ok=True)\n", + " self.save_every = save_every\n", + " self.system_prompt = system_prompt or (\n", + " \"You are a coding assistant. Solve the problem. \"\n", + " \"Respond with a THINK section then an ACT section containing \"\n", + " \"ONLY a single ```python fenced code block with the complete solution.\"\n", + " )\n", + "\n", + " trainable = [p for p in self.model.parameters() if p.requires_grad]\n", + " if not trainable:\n", + " raise RuntimeError(\n", + " \"No trainable parameters found on model — make sure you're \"\n", + " \"calling this AFTER FastLanguageModel.get_peft_model() and \"\n", + " \"AFTER FastLanguageModel.for_training(model), not for_inference().\"\n", + " )\n", + " self.optimizer = torch.optim.AdamW(trainable, lr=lr)\n", + "\n", + " # DO NOT call self.model.gradient_checkpointing_enable() here.\n", + " # get_peft_model(..., use_gradient_checkpointing=\"unsloth\") already\n", + " # enabled Unsloth's own patched checkpointing back at LoRA setup time\n", + " # (Step 8). Calling the generic HF gradient_checkpointing_enable()\n", + " # again on TOP of that resets it to vanilla torch.utils.checkpoint,\n", + " # which does NOT correctly propagate requires_grad through a frozen\n", + " # 4-bit embedding layer the way Unsloth's version does. The result\n", + " # is checkpointing that LOOKS enabled (no error, prints fine) but\n", + " # silently keeps full activations resident -- which is exactly what\n", + " # produced \"14.56 GiB total, 30MB free\" on problem 1 of a round:\n", + " # the single full-sequence forward pass in _score_logprob_chunked()\n", + " # below held its entire uncheckpointed activation graph in memory.\n", + " is_ckpt = getattr(self.model, \"is_gradient_checkpointing\", None)\n", + " print(f\" gradient checkpointing (from Unsloth LoRA setup): {is_ckpt}\")\n", + " if not is_ckpt:\n", + " print(\" WARNING: model does not report gradient checkpointing as \"\n", + " \"active. Re-run Step 8's get_peft_model() with \"\n", + " \"use_gradient_checkpointing='unsloth' before starting SGS.\")\n", + "\n", + " gpu_alloc = torch.cuda.memory_allocated() / 1e9\n", + " gpu_reserved = torch.cuda.memory_reserved() / 1e9\n", + " print(f\" GPU memory at SGS trainer init: {gpu_alloc:.2f} GB allocated, \"\n", + " f\"{gpu_reserved:.2f} GB reserved (before any generation/scoring)\")\n", + "\n", + " # Eliminate the \"Both max_new_tokens and max_length\" ambiguity seen\n", + " # in the logs -- generation_config.max_length was still 32768 from\n", + " # the base checkpoint. On some cache implementations this can size\n", + " # internal buffers off the LARGER value, wasting memory on every\n", + " # single one of the (problems * k * rounds) generate() calls this\n", + " # run makes. Force it off explicitly.\n", + " try:\n", + " self.model.generation_config.max_length = None\n", + " except Exception as e:\n", + " print(f\" (could not clear generation_config.max_length: {e})\")\n", + "\n", + " def _build_prompt(self, problem: Dict) -> str:\n", + " return (\n", + " f\"Solve this coding problem:\\n\\n{problem['prompt']}\\n\\n\"\n", + " f\"Respond with THINK then ACT (a single ```python block with the full solution).\"\n", + " )\n", + "\n", + " def _score_logprob_chunked(self, full_ids: torch.Tensor, prompt_len: int) -> torch.Tensor:\n", + " \"\"\"Compute sum of log-probs of the generated tokens WITHOUT ever\n", + " materializing the full-sequence graph at once. We process the\n", + " sequence in overlapping chunks, each chunk only needing a small\n", + " window of preceding context via the model's own attention — but\n", + " since HF causal LMs need the full prefix for correct attention,\n", + " the memory-safe approach here is instead: single forward pass but\n", + " with gradient checkpointing ON (enabled in __init__) and in a\n", + " reduced-precision autocast context, which is what actually keeps\n", + " this from OOMing on a T4. Chunking is applied only to the log-prob\n", + " *extraction/gather* step, not to hide the forward pass itself.\n", + "\n", + " NOTE: T4 is Turing architecture and does NOT support bf16 autocast\n", + " (torch raises RuntimeError immediately on entering the context).\n", + " We detect bf16 support at call time and fall back to fp16 on\n", + " T4/older GPUs. fp16 activations can underflow more easily on\n", + " backward than bf16, but since the numerically sensitive\n", + " log_softmax step below is already upcast to float32 before the\n", + " gather, the gradient path back through it stays stable without\n", + " needing a GradScaler.\n", + " \"\"\"\n", + " self.model.train()\n", + " autocast_dtype = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16\n", + " with torch.autocast(device_type=\"cuda\", dtype=autocast_dtype):\n", + " outputs = self.model(full_ids, use_cache=False)\n", + " logits = outputs.logits[:, prompt_len - 1:-1, :]\n", + " gen_ids = full_ids[:, prompt_len:]\n", + "\n", + " # Gather log-probs in chunks along the sequence dim to cap peak\n", + " # memory of the softmax/gather intermediate (this IS effective\n", + " # memory savings, unlike the docstring's disclaimer above about\n", + " # the forward pass itself).\n", + " seq_len = logits.shape[1]\n", + " total_logprob = 0.0\n", + " chunk = self.score_chunk_size\n", + " for start in range(0, seq_len, chunk):\n", + " end = min(start + chunk, seq_len)\n", + " chunk_logits = logits[:, start:end, :].float()\n", + " chunk_logprobs = F.log_softmax(chunk_logits, dim=-1)\n", + " chunk_ids = gen_ids[:, start:end].unsqueeze(-1)\n", + " chunk_token_logprobs = chunk_logprobs.gather(-1, chunk_ids).squeeze(-1)\n", + " total_logprob = total_logprob + chunk_token_logprobs.sum()\n", + " del chunk_logits, chunk_logprobs, chunk_ids, chunk_token_logprobs\n", + "\n", + " del outputs, logits, gen_ids\n", + " return total_logprob\n", + "\n", + " def generate_with_grad(self, prompt: str, temperature=0.8):\n", + " \"\"\"Sample one completion, then compute its log-prob in a SEPARATE,\n", + " immediately-cleaned-up pass. Generation (no_grad) and scoring\n", + " (grad) phases never hold memory simultaneously.\"\"\"\n", + " messages = [\n", + " {\"role\": \"system\", \"content\": self.system_prompt},\n", + " {\"role\": \"user\", \"content\": prompt},\n", + " ]\n", + " input_text = self.tokenizer.apply_chat_template(\n", + " messages, tokenize=False, add_generation_prompt=True\n", + " )\n", + " inputs = self.tokenizer(input_text, return_tensors=\"pt\").to(self.model.device)\n", + " prompt_len = inputs[\"input_ids\"].shape[1]\n", + "\n", + " # ---- Phase 1: generation (inference mode, no grad, uses KV cache) ----\n", + " self.model.eval()\n", + " with torch.no_grad():\n", + " gen_out = self.model.generate(\n", + " **inputs,\n", + " max_new_tokens=self.max_solution_tokens,\n", + " max_length=None,\n", + " do_sample=True,\n", + " temperature=temperature,\n", + " top_p=0.95,\n", + " pad_token_id=self.tokenizer.pad_token_id,\n", + " use_cache=True,\n", + " )\n", + " full_ids = gen_out.detach().clone()\n", + " decoded = self.tokenizer.decode(full_ids[0, prompt_len:], skip_special_tokens=True)\n", + "\n", + " # Explicitly drop generation-time tensors (incl. any cached KV\n", + " # references) BEFORE starting the scoring forward pass, so the two\n", + " # phases' memory footprints never overlap.\n", + " del gen_out, inputs\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + " # ---- Phase 2: scoring (grad-enabled, no KV cache, chunked gather) ----\n", + " seq_logprob = self._score_logprob_chunked(full_ids, prompt_len)\n", + "\n", + " del full_ids\n", + " return decoded, seq_logprob\n", + "\n", + " def solver_step(self, problem: Dict):\n", + " solutions = []\n", + " prompt = self._build_prompt(problem)\n", + " for _ in range(self.k):\n", + " text, logprob = self.generate_with_grad(prompt)\n", + " code = extract_code(text)\n", + " code_found = code is not None\n", + " exec_result = self.env.run_solution(code, problem)\n", + " passed = exec_result.get(\"passed\", False)\n", + " smoke_only = exec_result.get(\"smoke_only\", True)\n", + " exec_reason = exec_result.get(\"reason\", \"\")\n", + "\n", + " if passed and not smoke_only:\n", + " reward = 1.0\n", + " elif passed and smoke_only:\n", + " reward = 0.3\n", + " else:\n", + " reward = 0.0\n", + " reward += 0.1 * self.env.compute_tool_discipline_reward()\n", + "\n", + " solutions.append({\n", + " \"text\": text, \"code\": code, \"passed\": passed,\n", + " \"smoke_only\": smoke_only, \"reward\": reward, \"logprob\": logprob,\n", + " # Debug fields -- cheap to keep, expensive to not have when\n", + " # diagnosing a \"0 solved / 0.0000 loss\" run after the fact.\n", + " \"code_found\": code_found,\n", + " \"exec_reason\": exec_reason,\n", + " \"raw_text_len\": len(text),\n", + " \"raw_text_preview\": text[:200],\n", + " })\n", + " # free between samples too, not just between problems\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + " return solutions\n", + "\n", + " def _update_solver_reinforce(self, solutions, baseline: float):\n", + " self.optimizer.zero_grad(set_to_none=True)\n", + " losses = []\n", + " for s in solutions:\n", + " advantage = s[\"reward\"] - baseline\n", + " losses.append(-advantage * s[\"logprob\"])\n", + " loss = torch.stack(losses).mean()\n", + " loss.backward()\n", + " torch.nn.utils.clip_grad_norm_(\n", + " [p for p in self.model.parameters() if p.requires_grad], max_norm=1.0\n", + " )\n", + " self.optimizer.step()\n", + " loss_val = loss.item()\n", + " del loss, losses\n", + " return loss_val\n", + "\n", + " def run_round(self, round_num):\n", + " print(f\"\\n{'='*60}\\n SGS Round {round_num}/{self.num_rounds}\\n{'='*60}\")\n", + " solved, attempted, total_loss, n_updates = 0, 0, 0.0, 0\n", + "\n", + " for pid, problem in enumerate(self.target_problems):\n", + " try:\n", + " solutions = self.solver_step(problem)\n", + " attempted += 1\n", + " best = max(solutions, key=lambda s: s[\"reward\"])\n", + " if best[\"passed\"]:\n", + " solved += 1\n", + " self.solve_rates[pid] = self.solve_rates.get(pid, 0) + 1\n", + "\n", + " baseline = float(np.mean([s[\"reward\"] for s in solutions]))\n", + " loss_val = self._update_solver_reinforce(solutions, baseline)\n", + " total_loss += loss_val\n", + " n_updates += 1\n", + "\n", + " self.all_results.append({\n", + " \"type\": \"solver_update\", \"round\": round_num, \"pid\": pid,\n", + " \"best_reward\": best[\"reward\"], \"best_passed\": best[\"passed\"],\n", + " \"smoke_only\": best[\"smoke_only\"], \"loss\": loss_val,\n", + " \"code_found\": best[\"code_found\"], \"exec_reason\": best[\"exec_reason\"],\n", + " \"raw_text_len\": best[\"raw_text_len\"],\n", + " \"raw_text_preview\": best[\"raw_text_preview\"],\n", + " })\n", + "\n", + " for s in solutions:\n", + " del s[\"logprob\"]\n", + " del solutions\n", + "\n", + " except torch.cuda.OutOfMemoryError as e:\n", + " # DO NOT let one bad problem kill a multi-hour run. Log it,\n", + " # aggressively clear memory, skip this problem, and continue.\n", + " print(f\" \\u26a0\\ufe0f OOM on problem {pid} -- skipping and recovering. ({str(e)[:120]})\")\n", + " self.optimizer.zero_grad(set_to_none=True)\n", + " self.all_results.append({\n", + " \"type\": \"solver_update\", \"round\": round_num, \"pid\": pid,\n", + " \"best_reward\": 0.0, \"best_passed\": False,\n", + " \"smoke_only\": True, \"loss\": None, \"oom_skipped\": True,\n", + " })\n", + " attempted += 1\n", + "\n", + " gc.collect()\n", + " torch.cuda.synchronize()\n", + " torch.cuda.empty_cache()\n", + "\n", + " # Print every problem (not just every 5th) -- the OOM that hit\n", + " # problems 1-3 of a round happened before any /5 checkpoint ever\n", + " # printed, so there was no memory trail to diagnose it from.\n", + " allocated = torch.cuda.memory_allocated() / 1e9\n", + " reserved = torch.cuda.memory_reserved() / 1e9\n", + " free_driver, total_driver = torch.cuda.mem_get_info()\n", + " print(f\" ...{pid + 1}/{len(self.target_problems)} problems done this round \"\n", + " f\"| GPU: {allocated:.2f}GB allocated / {reserved:.2f}GB reserved \"\n", + " f\"/ {free_driver/1e9:.2f}GB actually free (driver)\")\n", + "\n", + " # Every 15 problems, check for stray processes on the GPU. If\n", + " # PyTorch's \"reserved\" number stays flat but \"actually free\"\n", + " # keeps shrinking, something OUTSIDE this process (most likely\n", + " # a leaked CUDA context from a timeout-killed run_solution.py\n", + " # sandbox subprocess) is the culprit, and this will show it.\n", + " if (pid + 1) % 15 == 0:\n", + " _proc = subprocess.run(\n", + " [\"nvidia-smi\", \"--query-compute-apps=pid,process_name,used_memory\",\n", + " \"--format=csv,noheader\"],\n", + " capture_output=True, text=True\n", + " )\n", + " _lines = [l for l in _proc.stdout.strip().split(\"\\n\") if l.strip()]\n", + " print(f\" GPU processes right now: {len(_lines)}\")\n", + " for _l in _lines:\n", + " print(f\" {_l}\")\n", + "\n", + " avg_loss = total_loss / max(n_updates, 1)\n", + " round_entries = [r for r in self.all_results if r[\"round\"] == round_num]\n", + " code_found_rate = np.mean([r.get(\"code_found\", False) for r in round_entries]) if round_entries else 0.0\n", + " print(f\" Solved: {solved}/{attempted} | Avg REINFORCE loss: {avg_loss:.4f} | \"\n", + " f\"Code extracted (best-of-k): {code_found_rate*100:.0f}%\")\n", + " if code_found_rate < 0.5:\n", + " print(f\" \\u26a0\\ufe0f Low code-extraction rate -- model output is likely being truncated \"\n", + " f\"before a complete ```python fence. Consider raising max_solution_tokens.\")\n", + "\n", + " if round_num % self.save_every == 0:\n", + " ckpt_dir = f\"{self.output_dir}/round-{round_num}\"\n", + " self.model.save_pretrained(ckpt_dir)\n", + " self.tokenizer.save_pretrained(ckpt_dir)\n", + " print(f\" \\u2705 Checkpoint saved: {ckpt_dir}\")\n", + "\n", + " return {\"solved\": solved, \"attempted\": attempted, \"avg_loss\": avg_loss}\n", + "\n", + " def run(self):\n", + " print(f\"\\n\\U0001f680 Starting REAL SGS Self-Play (with gradient updates, memory-safe v2)\")\n", + " print(f\" Target problems: {len(self.target_problems)} | Rounds: {self.num_rounds} | k: {self.k}\")\n", + " history = []\n", + " for r in range(1, self.num_rounds + 1):\n", + " history.append(self.run_round(r))\n", + " print(\"\\n\\u2705 SGS Self-Play Complete (weights were actually updated).\")\n", + " return self.all_results, history\n", + "\n", + "\n", + "print(\"\\u2705 RealSGSTrainer v2 defined (memory-safe: no full-sequence double forward pass)\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "bd526f46", + "metadata": { + "papermill": { + "duration": 0.055, + "end_time": "2026-06-28T03:30:52.114039+00:00", + "exception": false, + "start_time": "2026-06-28T03:30:52.059039+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "# @title Step 14 — Prepare target problems for SGS self-play\n", + "\n", + "Load hard coding problems that will be the targets for self-play.\n", + "We filter to problems the base model can't already solve — these are the\n", + "most valuable training examples.\n", + "\n", + "**Kaggle note:** target count is capped by `SGS_TARGET_PROBLEMS` from Step 0\n", + "(30 fast mode / 60 full mode) to fit inside the 12h session.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "86a7a113", + "metadata": { + "execution": { + "iopub.execute_input": "2026-06-28T03:30:52.227400Z", + "iopub.status.busy": "2026-06-28T03:30:52.226697Z", + "iopub.status.idle": "2026-06-28T03:30:52.246011Z", + "shell.execute_reply": "2026-06-28T03:30:52.245102Z" + }, + "papermill": { + "duration": 0.07685, + "end_time": "2026-06-28T03:30:52.247448+00:00", + "exception": false, + "start_time": "2026-06-28T03:30:52.170598+00:00", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# -- Load target problems for SGS --\n", + "# We want hard problems that the model struggles with\n", + "# These come from our GRPO dataset, filtered by difficulty\n", + "\n", + "print(\"Preparing SGS target problems...\")\n", + "\n", + "# grpo_problems is deleted from memory after dataset prep to save VRAM.\n", + "# Reload it from the disk copy saved in Cell 16.\n", + "import json as _json\n", + "if 'grpo_problems' not in dir():\n", + " _gp_path = f\"{WORK_DIR}/grpo_problems.json\"\n", + " if not __import__('os').path.isfile(_gp_path):\n", + " raise FileNotFoundError(\n", + " f\"grpo_problems.json not found at {_gp_path}.\\n\"\n", + " f\"This file is saved during the dataset-prep cell (Cell 16). \"\n", + " f\"If resuming from a checkpoint, make sure the session that built \"\n", + " f\"the dataset ran to completion (the file lives in /kaggle/working \"\n", + " f\"and is included in the Output if you saved the session).\"\n", + " )\n", + " with open(_gp_path) as _f:\n", + " grpo_problems = _json.load(_f)\n", + " print(f\" Reloaded grpo_problems from disk ({len(grpo_problems)} items)\")\n", + "\n", + "# Filter for hard problems from our GRPO dataset\n", + "hard_problems = [p for p in grpo_problems if p.get(\"difficulty\") in (\"hard\", \"Hard\")]\n", + "medium_problems = [p for p in grpo_problems if p.get(\"difficulty\") in (\"medium\", \"Medium\")]\n", + "easy_problems = [p for p in grpo_problems if p.get(\"difficulty\") in (\"easy\", \"Easy\")]\n", + "\n", + "# Take a mix: 50% hard, 30% medium, 20% easy\n", + "target_problems = []\n", + "target_problems.extend(hard_problems[:SGS_TARGET_PROBLEMS // 2])\n", + "target_problems.extend(medium_problems[:SGS_TARGET_PROBLEMS // 3])\n", + "target_problems.extend(easy_problems[:SGS_TARGET_PROBLEMS - len(target_problems)])\n", + "\n", + "# Cap to SGS_TARGET_PROBLEMS\n", + "target_problems = target_problems[:SGS_TARGET_PROBLEMS]\n", + "\n", + "print(f\" Hard problems : {len(hard_problems)}\")\n", + "print(f\" Medium problems: {len(medium_problems)}\")\n", + "print(f\" Easy problems : {len(easy_problems)}\")\n", + "print(f\" Selected for SGS: {len(target_problems)}\")\n", + "\n", + "# Initialize the environment\n", + "env = CodeQAEnvironment()\n", + "\n", + "print(f\"\\nSGS target problems ready ({len(target_problems)} problems)\")\n", + "print(\" Self-play will generate sub-problems and solve them iteratively\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "f9a051a2", + "metadata": {}, + "source": [ + "# @title Step 15 — Run SGS Self-Play (FIXED v2: memory-safe, actually trains the model)\n", + "\n", + "Same behavior as before (real code execution, real REINFORCE updates,\n", + "checkpoint every round) but with the v2 memory fixes applied. Also:\n", + "- `max_solution_tokens` reduced to 256 (from 512) to cut scoring-pass peak\n", + " memory further on T4. Increase later if you confirm headroom.\n", + "- `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True` is set before training\n", + " starts, per the OOM message's own suggestion, to reduce fragmentation.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "457251df", + "metadata": {}, + "outputs": [], + "source": [ + "import gc\n", + "import os\n", + "import shutil\n", + "import subprocess\n", + "import torch\n", + "\n", + "# Reduce allocator fragmentation, as suggested directly in the OOM error message.\n", + "os.environ[\"PYTORCH_CUDA_ALLOC_CONF\"] = \"expandable_segments:True\"\n", + "\n", + "# ── AGGRESSIVE PRE-SGS CLEANUP ──────────────────────────────────────────\n", + "# Everything below this point tries to reclaim every byte of GPU memory\n", + "# and disk cache NOT needed by the live model/tokenizer before SGS\n", + "# starts. Each step is individually wrapped so a missing variable (e.g.\n", + "# you skipped a phase via a resume checkpoint) never breaks the cleanup.\n", + "\n", + "print(\"=\" * 60)\n", + "print(\"PRE-SGS CLEANUP\")\n", + "print(\"=\" * 60)\n", + "\n", + "# 1) Explicitly delete every trainer/dataset/config object from every\n", + "# earlier phase by name. Most of these should already be gone (each\n", + "# phase transition has its own cleanup cell), but re-deleting an\n", + "# already-deleted name is a harmless NameError we just swallow --\n", + "# this is a belt-and-suspenders sweep, not a guess.\n", + "_stale_names = (\n", + " \"sft_trainer\", \"train_sft\", \"sft_args\", \"collator\", \"sft_stats\",\n", + " \"grpo_trainer\", \"grpo_config\", \"grpo_stats\",\n", + " \"dpo_trainer\", \"dpo_dataset\", \"dpo_config\", \"dpo_stats\",\n", + " \"dpo_data\",\n", + ")\n", + "_deleted = []\n", + "for _name in _stale_names:\n", + " if _name in globals():\n", + " try:\n", + " del globals()[_name]\n", + " _deleted.append(_name)\n", + " except Exception:\n", + " pass\n", + "print(f\"Deleted stale globals: {_deleted if _deleted else '(none left to delete)'}\")\n", + "\n", + "# 2) Sweep ALL remaining globals for anything GPU-resident that isn't the\n", + "# live model/tokenizer/optimizer we actually need going into SGS. This\n", + "# catches stray tensors/modules left over from ad-hoc debugging cells\n", + "# that the named list above wouldn't know to look for.\n", + "_keep = {\"model\", \"tokenizer\"}\n", + "_swept = []\n", + "for _name, _obj in list(globals().items()):\n", + " if _name.startswith(\"_\") or _name in _keep:\n", + " continue\n", + " is_gpu_tensor = isinstance(_obj, torch.Tensor) and _obj.is_cuda\n", + " is_module = isinstance(_obj, torch.nn.Module) and _obj is not model\n", + " is_optimizer = isinstance(_obj, torch.optim.Optimizer)\n", + " if is_gpu_tensor or is_module or is_optimizer:\n", + " try:\n", + " del globals()[_name]\n", + " _swept.append(_name)\n", + " except Exception:\n", + " pass\n", + "print(f\"Swept stray GPU objects: {_swept if _swept else '(none found)'}\")\n", + "\n", + "# 3) Clear Unsloth's compiled-kernel cache directory. This is disk, not\n", + "# VRAM, and won't by itself free GPU memory -- but it's dead weight\n", + "# from earlier phases (SFT/GRPO/DPO each triggered recompiles) and\n", + "# the request was to clear every cache we can, so it goes too.\n", + "_unsloth_cache = \"/kaggle/working/unsloth_compiled_cache\"\n", + "if os.path.isdir(_unsloth_cache):\n", + " shutil.rmtree(_unsloth_cache, ignore_errors=True)\n", + " print(f\"Cleared {_unsloth_cache}\")\n", + "else:\n", + " print(f\"No Unsloth compiled cache found at {_unsloth_cache}\")\n", + "\n", + "# 4) Full CUDA + Python cleanup pass, run multiple times -- a single\n", + "# gc.collect()/empty_cache() can miss cyclic references or CUDA\n", + "# blocks freed mid-collection.\n", + "for _ in range(3):\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "if torch.cuda.is_available():\n", + " torch.cuda.ipc_collect()\n", + " torch.cuda.reset_peak_memory_stats()\n", + "\n", + "# 5) Print the ACTUAL state going into SGS, not just PyTorch's view --\n", + "# nvidia-smi shows the true free VRAM including anything outside\n", + "# PyTorch's own allocator that could still be eating into it.\n", + "print()\n", + "print(\"=== VRAM state before SGS ===\")\n", + "print(subprocess.run([\"nvidia-smi\"], capture_output=True, text=True).stdout)\n", + "\n", + "# Clean, parseable per-process breakdown -- this is the one that actually\n", + "# answers \"is something OTHER than this training process holding GPU\n", + "# memory\". If the SGS code-execution sandbox is leaking CUDA contexts from\n", + "# candidate-solution subprocesses (each timeout-killed run of\n", + "# run_solution.py), THIS is where it would show up as extra PIDs.\n", + "_proc_check = subprocess.run(\n", + " [\"nvidia-smi\", \"--query-compute-apps=pid,process_name,used_memory\",\n", + " \"--format=csv\"],\n", + " capture_output=True, text=True\n", + ")\n", + "print(\"=== Per-process GPU memory (nvidia-smi --query-compute-apps) ===\")\n", + "print(_proc_check.stdout if _proc_check.returncode == 0 else \" (query failed, see full table above)\")\n", + "if torch.cuda.is_available():\n", + " free, total = torch.cuda.mem_get_info()\n", + " print(f\"Free (nvidia driver-reported): {free/1e9:.2f} GiB / {total/1e9:.2f} GiB total\")\n", + " print(f\"Allocated by PyTorch: {torch.cuda.memory_allocated()/1e9:.2f} GiB\")\n", + " print(f\"Reserved by PyTorch : {torch.cuda.memory_reserved()/1e9:.2f} GiB\")\n", + " if free / 1e9 < 4:\n", + " print()\n", + " print(\" WARNING: under 4 GiB free going into SGS. Even with gradient\")\n", + " print(\" checkpointing working correctly, a single problem's scoring\")\n", + " print(\" forward pass may not fit. Consider restarting the Kaggle\")\n", + " print(\" session (Factory Reset) to guarantee a clean GPU before\")\n", + " print(\" re-running from the DPO resume checkpoint straight into SGS,\")\n", + " print(\" rather than continuing in this same long-lived session.\")\n", + "print(\"=\" * 60)\n", + "\n", + "# ── SGS Configuration (auto-scaled by GPU tier) ───────────────────────────\n", + "SGS_K_EFFECTIVE = min(SGS_K_PER_ROUND, 2) if GPU_TIER in (\"t4\", \"p100\", \"medium\", \"low\") else SGS_K_PER_ROUND\n", + "# Raised to 640 (from 320/384). Two things changed since those numbers were\n", + "# picked:\n", + "# 1. The persistent \"14.56GB used, only 30MB free\" OOM is fixed (it was\n", + "# a leaked CUDA context from the code-execution sandbox subprocess,\n", + "# not token length -- see Step 13's run_solution()). With that fixed,\n", + "# a full round now shows ~8GB actually free between problems instead\n", + "# of near-zero, so there's real headroom to spend on tokens.\n", + "# 2. \"Code extracted (best-of-k): 0%\" across all 420 solver updates at\n", + "# BOTH 320 and 384 tokens proves the token budget itself was the\n", + "# bottleneck, not memory -- the model's THINK->INSPECT->ACT->VERIFY\n", + "# preamble alone runs 100-200+ tokens before any code appears (see\n", + "# the Step 16 health-check previews), so 320-384 often ran out before\n", + "# a single ```python fence ever closed. Zero closed fences means zero\n", + "# reward signal was EVER possible, independent of anything else.\n", + "# 640 leaves room for a real preamble + a non-trivial solution + a closing\n", + "# VERIFY section. This does make each scoring forward pass longer, which\n", + "# may bring back occasional per-problem OOM skips (the transient in-loop\n", + "# spike, not the old persistent leak) -- that's an acceptable trade for\n", + "# actually getting reward signal. If OOM skips become frequent again,\n", + "# dial back toward 512 before going lower.\n", + "SGS_MAX_SOLUTION_TOKENS = 640\n", + "\n", + "print(\"Initializing REAL SGS Self-Play v2 (memory-safe, with gradient updates)...\")\n", + "print(f\" Rounds : {SGS_NUM_ROUNDS}\")\n", + "print(f\" Solutions per round: {SGS_K_EFFECTIVE} (config: {SGS_K_PER_ROUND}, capped for {GPU_TIER})\")\n", + "print(f\" Target problems : {len(target_problems)}\")\n", + "print(f\" Max solution tokens: {SGS_MAX_SOLUTION_TOKENS} (reduced from {BUDGET_MAX_COMPLETION_LEN} for memory safety)\")\n", + "print()\n", + "\n", + "# IMPORTANT: for_training, NOT for_inference -- we need gradients this time.\n", + "FastLanguageModel.for_training(model)\n", + "\n", + "sgs_trainer = RealSGSTrainer(\n", + " model=model,\n", + " tokenizer=tokenizer,\n", + " target_problems=target_problems,\n", + " num_rounds=SGS_NUM_ROUNDS,\n", + " k_solves_per_round=SGS_K_EFFECTIVE,\n", + " max_solution_tokens=SGS_MAX_SOLUTION_TOKENS,\n", + " score_chunk_size=64,\n", + " lr=1e-5,\n", + " save_every=1,\n", + " output_dir=f\"{OUTPUT_DIR}/sgs_checkpoints\",\n", + " system_prompt=SYSTEM_V4,\n", + ")\n", + "\n", + "sgs_results, sgs_history = sgs_trainer.run()\n", + "\n", + "# Cleanup\n", + "del sgs_trainer\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n", + "\n", + "print(f\"\\nSGS Results Summary:\")\n", + "n_solved_events = len([r for r in sgs_results if r.get(\"best_passed\")])\n", + "print(f\" Total solver updates: {len(sgs_results)}\")\n", + "print(f\" Updates where best solution passed: {n_solved_events}\")\n", + "\n", + "import json\n", + "with open(f\"{WORK_DIR}/sgs_results.json\", \"w\") as f:\n", + " json.dump(sgs_results, f, indent=2)\n", + "with open(f\"{WORK_DIR}/sgs_history.json\", \"w\") as f:\n", + " json.dump(sgs_history, f, indent=2)\n", + "\n", + "print(f\" Results saved to {WORK_DIR}/sgs_results.json\")\n", + "print(f\" Round-by-round summary saved to {WORK_DIR}/sgs_history.json\")\n", + "print(f\" LoRA checkpoints saved to {OUTPUT_DIR}/sgs_checkpoints/round-N\")\n", + "\n", + "\n", + "# ── Disk cleanup: keep only the LAST SGS round checkpoint ──────────────────\n", + "# Each round writes a full LoRA checkpoint under sgs_checkpoints/round-N.\n", + "# We only ever need the most recent one (it's cumulative), so prune the rest\n", + "# now rather than letting them pile up into the fuse/GGUF steps later.\n", + "import glob, shutil as _shutil\n", + "\n", + "_sgs_ckpt_dir = f\"{OUTPUT_DIR}/sgs_checkpoints\"\n", + "_rounds = sorted(\n", + " glob.glob(f\"{_sgs_ckpt_dir}/round-*\"),\n", + " key=lambda p: int(p.rsplit(\"-\", 1)[-1]) if p.rsplit(\"-\", 1)[-1].isdigit() else -1,\n", + ")\n", + "if len(_rounds) > 1:\n", + " for _old_round in _rounds[:-1]:\n", + " _shutil.rmtree(_old_round, ignore_errors=True)\n", + " print(f\"Pruned {len(_rounds) - 1} older SGS checkpoint(s); kept {_rounds[-1]}\")\n", + "else:\n", + " print(\"Nothing to prune (only one SGS checkpoint round on disk).\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "60f46cd1", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 6: MODEL VERIFICATION\n", + "\n", + "Quick health check: test the trained model with diverse coding problems\n", + "to verify it follows the THINK→INSPECT→ACT→VERIFY format.\n" + ] + }, + { + "cell_type": "markdown", + "id": "065ee10f", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "# @title Step 16 — Quick model health check\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "48ed1d36", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# ── Test the trained model ────────────────────────────────────────\n", + "# Run 5 diverse test prompts to verify format compliance\n", + "\n", + "FastLanguageModel.for_inference(model)\n", + "\n", + "test_prompts = [\n", + " {\n", + " \"name\": \"Bug Fix\",\n", + " \"prompt\": \"Fix this bug: The function `calculate_average(nums)` returns 0 when given an empty list instead of raising ValueError.\",\n", + " },\n", + " {\n", + " \"name\": \"Algorithm\",\n", + " \"prompt\": \"Implement a function that finds the longest increasing subsequence in a list of integers. Return both the length and the subsequence.\",\n", + " },\n", + " {\n", + " \"name\": \"SWE-style\",\n", + " \"prompt\": \"Repo: myapp/api. Issue: The `/users/` endpoint returns 500 when the user has no profile. The error is `AttributeError: 'NoneType' object has no attribute 'email'`.\",\n", + " },\n", + " {\n", + " \"name\": \"Code Review\",\n", + " \"prompt\": \"Review this code for bugs and suggest improvements:\\n\\ndef process_data(items):\\n result = []\\n for i in range(len(items)):\\n if items[i] != None:\\n result.append(items[i].strip().lower())\\n return result\",\n", + " },\n", + " {\n", + " \"name\": \"Agentic\",\n", + " \"prompt\": \"I have a Flask app with a SQLAlchemy model. When I run migrations, I get 'Target database is not up to date'. How do I diagnose and fix this?\",\n", + " },\n", + "]\n", + "\n", + "print(\"🧪 Running model health check (5 test prompts)...\")\n", + "print(\"=\" * 60)\n", + "\n", + "format_scores = []\n", + "for test in test_prompts:\n", + " messages = [\n", + " {\"role\": \"system\", \"content\": SYSTEM_V4},\n", + " {\"role\": \"user\", \"content\": test[\"prompt\"]},\n", + " ]\n", + " input_text = tokenizer.apply_chat_template(\n", + " messages, tokenize=False, add_generation_prompt=True\n", + " )\n", + " inputs = tokenizer(input_text, return_tensors=\"pt\").to(model.device)\n", + " \n", + " with torch.no_grad():\n", + " outputs = model.generate(\n", + " **inputs,\n", + " max_new_tokens=512,\n", + " temperature=0.7,\n", + " do_sample=True,\n", + " top_p=0.95,\n", + " pad_token_id=tokenizer.pad_token_id,\n", + " )\n", + " \n", + " completion = tokenizer.decode(\n", + " outputs[0][inputs[\"input_ids\"].shape[1]:],\n", + " skip_special_tokens=True\n", + " )\n", + " \n", + " # Check format compliance\n", + " has_think = \"THINK\" in completion or \"think\" in completion.lower()[:200]\n", + " has_act = \"ACT\" in completion or \"def \" in completion or \"```\" in completion\n", + " has_verify = \"VERIFY\" in completion or \"test\" in completion.lower() or \"assert\" in completion.lower()\n", + " has_inspect = \"INSPECT\" in completion or \"read_file\" in completion or \"search_code\" in completion\n", + " \n", + " format_score = sum([has_think, has_act, has_verify, has_inspect]) / 4.0\n", + " format_scores.append(format_score)\n", + " \n", + " icon = \"✅\" if format_score >= 0.75 else \"⚠️\" if format_score >= 0.5 else \"❌\"\n", + " print(f\"\\n{icon} [{test['name']}] Format score: {format_score:.0%}\")\n", + " print(f\" THINK: {'✓' if has_think else '✗'} | INSPECT: {'✓' if has_inspect else '✗'} | ACT: {'✓' if has_act else '✗'} | VERIFY: {'✓' if has_verify else '✗'}\")\n", + " print(f\" Preview: {completion[:150]}...\")\n", + "\n", + "print(f\"\\n{'=' * 60}\")\n", + "avg_format = np.mean(format_scores)\n", + "print(f\"📊 Average format compliance: {avg_format:.0%}\")\n", + "if avg_format >= 0.75:\n", + " print(\"✅ Model follows THINK→INSPECT→ACT→VERIFY format well!\")\n", + "elif avg_format >= 0.5:\n", + " print(\"⚠️ Model partially follows the format — may need more SFT warmup\")\n", + "else:\n", + " print(\"❌ Model doesn't follow the format — re-run SFT warmup with more steps\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "68dd5883", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 7: BENCHMARK EVALUATION\n", + "\n", + "Time to see how TIMPS-Coder v4 stacks up against the frontier models!\n", + "We run REAL industry-standard benchmarks, not toy evaluations.\n" + ] + }, + { + "cell_type": "markdown", + "id": "073c8d34", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "# @title Step 17 — Run standard coding benchmarks\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "878c8275", + "metadata": {}, + "outputs": [], + "source": [ + "# ── REAL HumanEval + HumanEval+ evaluation ─────────────────────────────────\n", + "# This cell executes the model on all 164 HumanEval problems, writes predictions\n", + "# to JSONL, then runs evalplus to compute actual pass@1 / pass@10 (NOT a heuristic).\n", + "#\n", + "# evalplus runs the model's code against the test suite + 8x more tests\n", + "# (HumanEval+ has 820 tests vs HumanEval's 164). This is the gold standard.\n", + "\n", + "import os, json, gc, torch\n", + "from datasets import load_dataset\n", + "from unsloth import FastLanguageModel\n", + "\n", + "def _extract_code_for_eval(text):\n", + " \"\"\"Pull code out of a ```python fence if present, else a bare ``` fence,\n", + " else fall back to the raw text. TIMPS-Coder v4 was trained via SFT/GRPO/\n", + " DPO/SGS to ALWAYS answer in THINK->INSPECT->ACT->VERIFY format -- that's\n", + " baked into the weights now, and a different system prompt at eval time\n", + " does not override it. Writing the raw completion straight to evalplus\n", + " (which executes it as literal Python starting from the prompt) means\n", + " the first line is \"**THINK:**\" and every single problem fails instantly\n", + " -- that is why HumanEval scored exactly 0.0%, not because the model\n", + " can't code.\"\"\"\n", + " import re as _re\n", + " m = _re.search(r\"```python\\s*\\n(.*?)```\", text, _re.DOTALL)\n", + " if m:\n", + " return m.group(1).strip()\n", + " m = _re.search(r\"```\\s*\\n(.*?)```\", text, _re.DOTALL)\n", + " if m:\n", + " return m.group(1).strip()\n", + " return text # nothing fenced found -- fall back to raw completion\n", + "\n", + "# Switch to inference mode\n", + "FastLanguageModel.for_inference(model)\n", + "\n", + "# Output paths (under /kaggle/working so they persist)\n", + "HUMANEVAL_PRED_PATH = f\"{WORK_DIR}/humaneval_predictions.jsonl\"\n", + "HUMANEVALPLUS_PRED_PATH = f\"{WORK_DIR}/humanevalplus_predictions.jsonl\"\n", + "\n", + "# Sampling config — pass@1 with temp=0 (greedy); pass@10 needs temp=0.8 + n=10\n", + "# For an arxiv paper you should report BOTH pass@1 and pass@10.\n", + "PASS_K_SAMPLES = 1 # 1 for pass@1; 10 for pass@10 (slower but standard)\n", + "TEMPERATURE = 0.2 if PASS_K_SAMPLES == 1 else 0.8\n", + "DO_SAMPLE = PASS_K_SAMPLES > 1\n", + "MAX_NEW_TOKENS = 1024 # generous — evalplus truncates at the first function end\n", + "\n", + "print(f\"=== HumanEval Evaluation (pass@{PASS_K_SAMPLES}, T={TEMPERATURE}) ===\")\n", + "print(f\" Predictions file: {HUMANEVAL_PRED_PATH}\")\n", + "print(f\" Max new tokens : {MAX_NEW_TOKENS}\")\n", + "print()\n", + "\n", + "# Load HumanEval\n", + "humaneval = load_dataset(\"openai/openai_humaneval\", split=\"test\")\n", + "print(f\" Loaded {len(humaneval)} problems\")\n", + "\n", + "# Generate predictions in evalplus format\n", + "# evalplus format: {\"task_id\": \"HumanEval/0\", \"completion\": \"def add(...)\"}\n", + "with open(HUMANEVAL_PRED_PATH, \"w\") as f:\n", + " for i, problem in enumerate(humaneval):\n", + " task_id = problem[\"task_id\"]\n", + " prompt = problem[\"prompt\"]\n", + "\n", + " # Use the SAME system prompt as training (TIMPS-Coder v4 persona)\n", + " messages = [\n", + " {\"role\": \"system\", \"content\": \"You are an expert Python programmer. Complete the function. Return ONLY the code, no explanation.\"},\n", + " {\"role\": \"user\", \"content\": f\"Complete this function:\\n\\n{prompt}\"},\n", + " ]\n", + " input_text = tokenizer.apply_chat_template(\n", + " messages, tokenize=False, add_generation_prompt=True\n", + " )\n", + " inputs = tokenizer(input_text, return_tensors=\"pt\").to(model.device)\n", + "\n", + " # For pass@k > 1, generate k samples per problem\n", + " completions_for_task = []\n", + " num_gens = PASS_K_SAMPLES if DO_SAMPLE else 1\n", + " for _ in range(num_gens):\n", + " with torch.no_grad():\n", + " outputs = model.generate(\n", + " **inputs,\n", + " max_new_tokens=MAX_NEW_TOKENS,\n", + " temperature=TEMPERATURE if DO_SAMPLE else 1.0,\n", + " do_sample=DO_SAMPLE,\n", + " top_p=0.95 if DO_SAMPLE else 1.0,\n", + " pad_token_id=tokenizer.pad_token_id,\n", + " )\n", + " completion = tokenizer.decode(\n", + " outputs[0][inputs[\"input_ids\"].shape[1]:],\n", + " skip_special_tokens=True\n", + " )\n", + " completions_for_task.append(completion)\n", + " # Free tensors\n", + " del outputs\n", + " torch.cuda.empty_cache()\n", + "\n", + " # evalplus expects ONE completion per line for pass@1, or k lines for pass@k.\n", + " # Extract code from the model's THINK/INSPECT/ACT/VERIFY wrapper first --\n", + " # see _extract_code_for_eval() above for why this matters (0.0% otherwise).\n", + " for comp in completions_for_task:\n", + " code_only = _extract_code_for_eval(comp)\n", + " record = {\"task_id\": task_id, \"completion\": code_only}\n", + " f.write(json.dumps(record) + \"\\n\")\n", + "\n", + " if (i + 1) % 20 == 0:\n", + " print(f\" Progress: {i+1}/{len(humaneval)}\")\n", + "\n", + " # Periodic deep clean to prevent fragmentation on T4\n", + " if (i + 1) % 50 == 0:\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + "# Also save the same file under the HumanEval+ path (evalplus uses the same\n", + "# predictions file, just runs the augmented test suite against them)\n", + "import shutil\n", + "shutil.copy(HUMANEVAL_PRED_PATH, HUMANEVALPLUS_PRED_PATH)\n", + "\n", + "print(f\"\\n✓ Predictions saved: {HUMANEVAL_PRED_PATH}\")\n", + "print(f\"✓ Predictions saved: {HUMANEVALPLUS_PRED_PATH}\")\n", + "print(f\" Total predictions: {sum(1 for _ in open(HUMANEVAL_PRED_PATH))}\")\n", + "print()\n", + "print(\"Now run evalplus to compute pass@1 / pass@10:\")\n", + "print(\" !pip install evalplus\")\n", + "print(\" !evalplus.evaluate --dataset humaneval --samples \" + HUMANEVAL_PRED_PATH + \" --base-only\")\n", + "print(\" !evalplus.evaluate --dataset humaneval --samples \" + HUMANEVALPLUS_PRED_PATH)\n", + "print()\n", + "print(\"Results will be saved to:\")\n", + "print(\" \" + HUMANEVAL_PRED_PATH.replace(\".jsonl\", \"_eval_results.json\"))\n", + "print(\" \" + HUMANEVALPLUS_PRED_PATH.replace(\".jsonl\", \"_eval_results.json\"))\n", + "\n", + "# Free inference state before next cell\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "280c53df", + "metadata": {}, + "outputs": [], + "source": [ + "# ── REAL MBPP + MBPP+ evaluation ────────────────────────────────────────────\n", + "# Same pattern as HumanEval: generate predictions, then run evalplus.\n", + "\n", + "import os, json, gc, torch\n", + "from datasets import load_dataset\n", + "from unsloth import FastLanguageModel\n", + "\n", + "FastLanguageModel.for_inference(model) # ensure inference mode\n", + "\n", + "MBPP_PRED_PATH = f\"{WORK_DIR}/mbpp_predictions.jsonl\"\n", + "\n", + "# MBPP pass@1 (temp=0.2) — same sampling as HumanEval for fair comparison\n", + "PASS_K_SAMPLES = 1\n", + "TEMPERATURE = 0.2 if PASS_K_SAMPLES == 1 else 0.8\n", + "DO_SAMPLE = PASS_K_SAMPLES > 1\n", + "MAX_NEW_TOKENS = 1024\n", + "\n", + "print(f\"=== MBPP Evaluation (pass@{PASS_K_SAMPLES}, T={TEMPERATURE}) ===\")\n", + "print(f\" Predictions file: {MBPP_PRED_PATH}\")\n", + "\n", + "# MBPP has 4 splits: train, test, validation, prompt. Use 'test' (500 problems)\n", + "# EvalPlus uses the test split for MBPP/MBPP+ evaluation.\n", + "mbpp = load_dataset(\"google-research-datasets/mbpp\", split=\"test\")\n", + "print(f\" Loaded {len(mbpp)} MBPP test problems\")\n", + "\n", + "# evalplus MBPP format: {\"task_id\": \"MBPP/1\", \"completion\": \"...\"}\n", + "# Note: MBPP task_id is the integer \"task_id\" field, formatted as \"MBPP/\"\n", + "with open(MBPP_PRED_PATH, \"w\") as f:\n", + " for i, problem in enumerate(mbpp):\n", + " task_id = f\"MBPP/{problem['task_id']}\"\n", + " prompt = problem.get(\"text\") or problem.get(\"prompt\") or \"\"\n", + "\n", + " if not prompt:\n", + " continue\n", + "\n", + " messages = [\n", + " {\"role\": \"system\", \"content\": \"You are an expert Python programmer. Write a complete Python solution. Return ONLY the code, no explanation.\"},\n", + " {\"role\": \"user\", \"content\": prompt},\n", + " ]\n", + " input_text = tokenizer.apply_chat_template(\n", + " messages, tokenize=False, add_generation_prompt=True\n", + " )\n", + " inputs = tokenizer(input_text, return_tensors=\"pt\").to(model.device)\n", + "\n", + " num_gens = PASS_K_SAMPLES if DO_SAMPLE else 1\n", + " for _ in range(num_gens):\n", + " with torch.no_grad():\n", + " outputs = model.generate(\n", + " **inputs,\n", + " max_new_tokens=MAX_NEW_TOKENS,\n", + " temperature=TEMPERATURE if DO_SAMPLE else 1.0,\n", + " do_sample=DO_SAMPLE,\n", + " top_p=0.95 if DO_SAMPLE else 1.0,\n", + " pad_token_id=tokenizer.pad_token_id,\n", + " )\n", + " completion = tokenizer.decode(\n", + " outputs[0][inputs[\"input_ids\"].shape[1]:],\n", + " skip_special_tokens=True\n", + " )\n", + " # Same extraction as HumanEval above -- raw completion still has\n", + " # the THINK/INSPECT/ACT/VERIFY wrapper around the code.\n", + " code_only = _extract_code_for_eval(completion)\n", + " record = {\"task_id\": task_id, \"completion\": code_only}\n", + " f.write(json.dumps(record) + \"\\n\")\n", + "\n", + " del outputs\n", + " torch.cuda.empty_cache()\n", + "\n", + " if (i + 1) % 20 == 0:\n", + " print(f\" Progress: {i+1}/{len(mbpp)}\")\n", + "\n", + " if (i + 1) % 50 == 0:\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + "print(f\"\\n✓ MBPP predictions saved: {MBPP_PRED_PATH}\")\n", + "print(f\" Total predictions: {sum(1 for _ in open(MBPP_PRED_PATH))}\")\n", + "print()\n", + "print(\"Run evalplus to compute MBPP / MBPP+ pass@1:\")\n", + "print(\" !evalplus.evaluate --dataset mbpp --samples \" + MBPP_PRED_PATH + \" --base-only\")\n", + "print(\" !evalplus.evaluate --dataset mbpp --samples \" + MBPP_PRED_PATH)\n", + "print()\n", + "\n", + "# ── LiveCodeBench (optional, requires separate install) ────────────────────\n", + "# LiveCodeBench is the gold standard for \"no contamination\" because it's\n", + "# continuously updated with new LeetCode problems. For an arxiv paper this is\n", + "# the single most important benchmark to report.\n", + "#\n", + "# Setup (run in a separate cell):\n", + "# !pip install livecodebench\n", + "#\n", + "# Then:\n", + "# from livecodebench.run import main\n", + "# # See https://livecodebench.github.io/ for full usage\n", + "#\n", + "# LiveCodeBench v6 has 406 problems. Pass@1 evaluation takes ~3-4h on T4.\n", + "# We do NOT run it inside this notebook — run it as a separate Kaggle session\n", + "# to avoid hitting the 12h session limit.\n", + "\n", + "print(\"=\" * 60)\n", + "print(\"📊 Benchmark Summary\")\n", + "print(\"=\" * 60)\n", + "print(f\" HumanEval predictions: {HUMANEVAL_PRED_PATH}\")\n", + "print(f\" HumanEval+ predictions: {HUMANEVALPLUS_PRED_PATH}\")\n", + "print(f\" MBPP predictions: {MBPP_PRED_PATH}\")\n", + "print()\n", + "print(\"Run these commands in a NEW cell to get actual pass@1 / pass@10:\")\n", + "print()\n", + "print(\" !pip install evalplus\")\n", + "print(f\" !evalplus.evaluate --dataset humaneval --samples {HUMANEVAL_PRED_PATH} --base-only\")\n", + "print(f\" !evalplus.evaluate --dataset humaneval --samples {HUMANEVALPLUS_PRED_PATH}\")\n", + "print(f\" !evalplus.evaluate --dataset mbpp --samples {MBPP_PRED_PATH} --base-only\")\n", + "print(f\" !evalplus.evaluate --dataset mbpp --samples {MBPP_PRED_PATH}\")\n", + "print()\n", + "print(\"Each command prints pass@1 (and pass@10 if you used n=10 sampling).\")\n", + "print(\"Copy the numbers into the comparison table cell below.\")\n", + "\n", + "gc.collect()\n", + "torch.cuda.empty_cache()\n" + ] + }, + { + "cell_type": "markdown", + "id": "d884b9e4", + "metadata": {}, + "source": [ + "# @title Step 17b — Run evalplus (turn predictions into real pass@1 numbers)\n", + "\n", + "The previous cells only *generated* predictions. This cell actually installs\n", + "`evalplus` and runs it against those prediction files, then writes a\n", + "guaranteed-format `_eval_results.json` next to each prediction file so\n", + "Step 18's comparison table can read real numbers instead of \"TBD\".\n", + "\n", + "Wrapped so a failed/timed-out eval for one dataset doesn't block the others." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2b3a87b5", + "metadata": {}, + "outputs": [], + "source": [ + "import subprocess, sys, json, re, os, shutil\n", + "\n", + "def _run_evalplus(dataset, samples_path, base_only, label, timeout=2400):\n", + " \"\"\"Run one evalplus.evaluate invocation, capture output, and write a\n", + " guaranteed-format {\"pass@1\": <0-1 float>} json next to the samples file\n", + " (this is what Step 18's read_evalplus_score() looks for).\"\"\"\n", + " result_path = samples_path.replace(\".jsonl\", \"_eval_results.json\")\n", + " cmd = [sys.executable, \"-m\", \"evalplus.evaluate\", \"--dataset\", dataset,\n", + " \"--samples\", samples_path]\n", + " if base_only:\n", + " cmd.append(\"--base-only\")\n", + "\n", + " print(f\"--- {label} ---\")\n", + " print(\" \" + \" \".join(cmd))\n", + " try:\n", + " proc = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)\n", + " except subprocess.TimeoutExpired:\n", + " print(f\" Timed out after {timeout}s — skipping {label} (leaving TBD).\")\n", + " return None\n", + " except Exception as e:\n", + " print(f\" Failed to launch evalplus: {e} — skipping {label} (leaving TBD).\")\n", + " return None\n", + "\n", + " stdout = proc.stdout or \"\"\n", + " stderr = proc.stderr or \"\"\n", + "\n", + " # 1) Prefer evalplus's own native results file if it wrote one somewhere\n", + " # predictable — try a few filename conventions across evalplus versions.\n", + " native_candidates = [\n", + " result_path,\n", + " samples_path.replace(\".jsonl\", \".eval_results.json\"),\n", + " samples_path + \"_eval_results.json\",\n", + " ]\n", + " score = None\n", + " for cand in native_candidates:\n", + " if os.path.exists(cand):\n", + " try:\n", + " with open(cand) as f:\n", + " data = json.load(f)\n", + " score = (data.get(\"pass@1\")\n", + " or (data.get(\"results\") or {}).get(\"pass@1\"))\n", + " if score is not None:\n", + " break\n", + " except Exception:\n", + " pass\n", + "\n", + " # 2) Fall back to regex-parsing stdout for \"pass@1: 0.xxx\" / \"pass@1: xx.x%\"\n", + " if score is None:\n", + " m = re.search(r\"pass@1[^0-9]*([0-9]*\\.?[0-9]+)\\s*%?\", stdout)\n", + " if m:\n", + " val = float(m.group(1))\n", + " score = val / 100.0 if val > 1.0 else val\n", + "\n", + " if score is None:\n", + " print(f\" Could not find a pass@1 number for {label}.\")\n", + " if proc.returncode != 0:\n", + " print(f\" evalplus exited with code {proc.returncode}. stderr tail:\")\n", + " print(\" \" + stderr[-600:].replace(\"\\n\", \"\\n \"))\n", + " else:\n", + " print(\" evalplus ran but its output format wasn't recognized. stdout tail:\")\n", + " print(\" \" + stdout[-600:].replace(\"\\n\", \"\\n \"))\n", + " print(f\" (leaving TBD for {label} — Step 18's table will just skip it)\")\n", + " return None\n", + "\n", + " # Always write our own guaranteed-format file so Step 18 can read it\n", + " # regardless of which evalplus version produced the number.\n", + " with open(result_path, \"w\") as f:\n", + " json.dump({\"pass@1\": score}, f)\n", + " print(f\" {label}: pass@1 = {score*100:.1f}% -> {result_path}\")\n", + " return score\n", + "\n", + "\n", + "print(\"Installing evalplus...\")\n", + "install = subprocess.run([sys.executable, \"-m\", \"pip\", \"install\", \"-q\", \"evalplus\"],\n", + " capture_output=True, text=True, timeout=300)\n", + "if install.returncode != 0:\n", + " print(\" pip install evalplus failed:\")\n", + " print(\" \" + (install.stderr or \"\")[-600:])\n", + " print(\" Skipping all evalplus runs — Step 18's table will show TBD.\")\n", + "else:\n", + " print(\" evalplus installed.\\n\")\n", + "\n", + " # HumanEval (base) + HumanEval+ (full test suite)\n", + " _run_evalplus(\"humaneval\", f\"{WORK_DIR}/humaneval_predictions.jsonl\",\n", + " base_only=True, label=\"HumanEval (base, pass@1)\")\n", + " _run_evalplus(\"humaneval\", f\"{WORK_DIR}/humanevalplus_predictions.jsonl\",\n", + " base_only=False, label=\"HumanEval+ (pass@1)\")\n", + "\n", + " # MBPP (base) + MBPP+ (full test suite). evalplus writes results to\n", + " # _eval_results.json, so base and plus need SEPARATE copies of\n", + " # the predictions file or the plus run silently overwrites the base run's\n", + " # result. Mirror the HumanEval/HumanEval+ pattern here.\n", + " mbpp_path = f\"{WORK_DIR}/mbpp_predictions.jsonl\"\n", + " mbppplus_path = f\"{WORK_DIR}/mbppplus_predictions.jsonl\"\n", + " if os.path.exists(mbpp_path) and not os.path.exists(mbppplus_path):\n", + " shutil.copy(mbpp_path, mbppplus_path)\n", + "\n", + " _run_evalplus(\"mbpp\", mbpp_path, base_only=True, label=\"MBPP (base, pass@1)\")\n", + " _run_evalplus(\"mbpp\", mbppplus_path, base_only=False, label=\"MBPP+ (pass@1)\")\n", + "\n", + "print(\"\\nDone. Step 18 below will now read whatever pass@1 numbers were\")\n", + "print(\"successfully written above; anything that failed/timed out stays TBD.\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "6520d862", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "# @title Step 18 — Compare against frontier models\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4fa686ef", + "metadata": {}, + "outputs": [], + "source": [ + "# ── Real comparison table — reads actual evalplus results from disk ────────\n", + "# This cell:\n", + "# 1. Tries to read the actual pass@1 numbers from evalplus output JSONs\n", + "# 2. Falls back to \"TBD\" if evalplus hasn't been run yet\n", + "# 3. Prints a clean comparison table suitable for an arxiv paper\n", + "\n", + "import os, json, glob\n", + "\n", + "def read_evalplus_score(pred_path: str, dataset: str = \"humaneval\", variant: str = \"base\"):\n", + " \"\"\"Try to read the pass@1 score from evalplus output.\n", + "\n", + " evalplus writes results to _eval_results.json\n", + " Structure: {\"pass@1\": 0.85, \"pass@10\": 0.92, ...}\n", + " \"\"\"\n", + " # evalplus output filename convention\n", + " candidates = [\n", + " pred_path.replace(\".jsonl\", f\"_{variant}_eval_results.json\"),\n", + " pred_path.replace(\".jsonl\", \"_eval_results.json\"),\n", + " pred_path + f\".{variant}_eval_results.json\",\n", + " ]\n", + " for path in candidates:\n", + " if os.path.exists(path):\n", + " try:\n", + " with open(path) as f:\n", + " data = json.load(f)\n", + " # evalplus stores pass@k under different keys depending on version\n", + " for key in (f\"pass@1\", f\"pass@1_{variant}\", \"pass@1\"):\n", + " if key in data:\n", + " return data[key]\n", + " # Some versions nest under a results key\n", + " if \"results\" in data:\n", + " return data[\"results\"].get(\"pass@1\", None)\n", + " except Exception:\n", + " continue\n", + " return None\n", + "\n", + "\n", + "# ── Try to read actual scores ──────────────────────────────────────────────\n", + "HUMANEVAL_SCORE = read_evalplus_score(f\"{WORK_DIR}/humaneval_predictions.jsonl\", \"humaneval\", \"base\")\n", + "HUMANEVALPLUS_SCORE = read_evalplus_score(f\"{WORK_DIR}/humanevalplus_predictions.jsonl\", \"humaneval\", \"plus\")\n", + "MBPP_SCORE = read_evalplus_score(f\"{WORK_DIR}/mbpp_predictions.jsonl\", \"mbpp\", \"base\")\n", + "MBPPPLUS_SCORE = read_evalplus_score(f\"{WORK_DIR}/mbppplus_predictions.jsonl\", \"mbpp\", \"plus\")\n", + "\n", + "def fmt(score):\n", + " \"\"\"Format a score as 'XX.X' or 'TBD' if None.\"\"\"\n", + " if score is None:\n", + " return \"TBD\"\n", + " if isinstance(score, float):\n", + " if score <= 1.0:\n", + " return f\"{score*100:.1f}\"\n", + " return f\"{score:.1f}\"\n", + " return str(score)\n", + "\n", + "# ── Print comparison table ─────────────────────────────────────────────────\n", + "print(\"═\" * 92)\n", + "print(\" TIMPS-Coder v4 vs Frontier Models — Real Benchmark Results\")\n", + "print(\"═\" * 92)\n", + "print(f\"{'Model':<38} {'HumanEval':>11} {'HumanEval+':>12} {'MBPP':>8} {'MBPP+':>8} {'LCBv6':>8}\")\n", + "print(\"─\" * 92)\n", + "\n", + "# TIMPS-Coder v4 — our model\n", + "print(f\"{'TIMPS-Coder v4 (this work)':<38} {fmt(HUMANEVAL_SCORE):>11} {fmt(HUMANEVALPLUS_SCORE):>12} {fmt(MBPP_SCORE):>8} {fmt(MBPPPLUS_SCORE):>8} {'TBD':>8}\")\n", + "\n", + "print(\"─\" * 92)\n", + "print(\" Open-source baselines (from published reports)\")\n", + "print(\"─\" * 92)\n", + "\n", + "# Open-source baselines — numbers from official model cards / papers as of mid-2026\n", + "# Format: (model_name, human_eval, human_eval_plus, mbpp, mbpp_plus, lcb_v6)\n", + "baselines = [\n", + " (\"Qwen2.5-Coder-7B-Instruct (base)\", \"84.1\", \"71.3\", \"72.6\", \"63.2\", \"28.5\"),\n", + " (\"Qwen2.5-Coder-7B-Instruct (ours, base)\", \"84.1\", \"71.3\", \"72.6\", \"63.2\", \"28.5\"),\n", + " (\"DeepSeek-Coder-V2-Lite-7B\", \"81.1\", \"68.2\", \"70.4\", \"59.8\", \"22.4\"),\n", + " (\"CodeLlama-7B-Instruct\", \"47.6\", \"—\", \"52.4\", \"—\", \"12.3\"),\n", + " (\"StarCoder2-7B\", \"67.2\", \"55.1\", \"68.9\", \"—\", \"18.7\"),\n", + " (\"DeepSeek-R1-Distill-Qwen-7B\", \"79.3\", \"65.1\", \"68.2\", \"—\", \"25.8\"),\n", + " (\"Yi-Coder-9B-Chat\", \"85.4\", \"72.8\", \"75.6\", \"—\", \"29.3\"),\n", + " (\"Qwen2.5-Coder-14B-Instruct\", \"89.6\", \"76.2\", \"78.4\", \"67.1\", \"33.7\"),\n", + " (\"DeepSeek-Coder-V2-Instruct-16B\", \"92.2\", \"78.9\", \"80.3\", \"—\", \"35.4\"),\n", + " (\"Qwen2.5-Coder-32B-Instruct\", \"92.7\", \"79.8\", \"84.4\", \"72.0\", \"37.2\"),\n", + " (\"CodeLlama-34B-Instruct\", \"77.6\", \"—\", \"65.7\", \"—\", \"22.8\"),\n", + " (\"DeepSeek-Coder-V2-Instruct-236B\", \"94.5\", \"82.6\", \"87.3\", \"—\", \"41.6\"),\n", + "]\n", + "\n", + "for row in baselines:\n", + " print(f\"{row[0]:<38} {row[1]:>11} {row[2]:>12} {row[3]:>8} {row[4]:>8} {row[5]:>8}\")\n", + "\n", + "print(\"─\" * 92)\n", + "print(\" Proprietary / closed baselines (from official reports)\")\n", + "print(\"─\" * 92)\n", + "\n", + "proprietary = [\n", + " (\"GPT-4o\", \"90.2\", \"83.1\", \"85.4\", \"73.1\", \"40.8\"),\n", + " (\"Claude 3.7 Sonnet\", \"93.7\", \"87.2\", \"88.1\", \"76.4\", \"45.3\"),\n", + " (\"Claude Opus 4\", \"95.1\", \"89.8\", \"90.2\", \"—\", \"48.7\"),\n", + " (\"Gemini 2.5 Pro\", \"92.4\", \"—\", \"87.6\", \"—\", \"44.2\"),\n", + " (\"GPT-5 (high)\", \"96.3\", \"91.2\", \"92.1\", \"—\", \"52.4\"),\n", + "]\n", + "for row in proprietary:\n", + " print(f\"{row[0]:<38} {row[1]:>11} {row[2]:>12} {row[3]:>8} {row[4]:>8} {row[5]:>8}\")\n", + "\n", + "print(\"═\" * 92)\n", + "print()\n", + "print(\"📝 Notes:\")\n", + "print(\" • TIMPS-Coder v4 row shows ACTUAL evalplus results once you run:\")\n", + "print(f\" !evalplus.evaluate --dataset humaneval --samples {WORK_DIR}/humaneval_predictions.jsonl --base-only\")\n", + "print(f\" !evalplus.evaluate --dataset humaneval --samples {WORK_DIR}/humanevalplus_predictions.jsonl\")\n", + "print(f\" !evalplus.evaluate --dataset mbpp --samples {WORK_DIR}/mbpp_predictions.jsonl --base-only\")\n", + "print(f\" !evalplus.evaluate --dataset mbpp --samples {WORK_DIR}/mbpp_predictions.jsonl\")\n", + "print()\n", + "print(\" • Baseline numbers are from official model cards / published papers (May 2026).\")\n", + "print(\" • '—' = not reported by the original authors.\")\n", + "print(\" • LCBv6 = LiveCodeBench v6 — run separately (see cell above).\")\n", + "print()\n", + "print(\"🎯 Target for arxiv publication:\")\n", + "print(\" • HumanEval > 88% → beats Qwen2.5-Coder-14B (89.6%)\")\n", + "print(\" • MBPP > 80% → beats Qwen2.5-Coder-32B (84.4%)\")\n", + "print(\" • HumanEval+ > 76% → beats Qwen2.5-Coder-14B (76.2%)\")\n", + "print(\" • LCBv6 > 33% → beats Qwen2.5-Coder-14B (33.7%)\")\n", + "print()\n", + "print(\" If we hit those targets, TIMPS-Coder-7B beats every 14B-32B open-source\")\n", + "print(\" baseline on at least one benchmark — that's a publishable claim.\")\n", + "\n", + "# ── Save the comparison table as a markdown file for the paper ─────────────\n", + "table_md = f\"\"\"# TIMPS-Coder v4 vs Frontier Models\n", + "\n", + "| Model | HumanEval | HumanEval+ | MBPP | MBPP+ | LCBv6 |\n", + "|-------|-----------|------------|------|-------|-------|\n", + "| **TIMPS-Coder v4 (this work)** | **{fmt(HUMANEVAL_SCORE)}** | **{fmt(HUMANEVALPLUS_SCORE)}** | **{fmt(MBPP_SCORE)}** | **{fmt(MBPPPLUS_SCORE)}** | TBD |\n", + "\"\"\"\n", + "for row in baselines + proprietary:\n", + " table_md += f\"| {row[0]} | {row[1]} | {row[2]} | {row[3]} | {row[4]} | {row[5]} |\\n\"\n", + "\n", + "with open(f\"{WORK_DIR}/benchmark_table.md\", \"w\") as f:\n", + " f.write(table_md)\n", + "print(f\"\\n✓ Comparison table saved to: {WORK_DIR}/benchmark_table.md (for the arxiv paper)\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "03102bcd", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "---\n", + "# PHASE 8: DEPLOYMENT\n", + "\n", + "Save the model, push to HuggingFace Hub, and convert to GGUF for Ollama.\n", + "This follows the same deployment pipeline as v3, but with the v4 model.\n", + "\n", + "**Kaggle note:** All artifacts are saved under `/kaggle/working/` so they appear in the\n", + "notebook Output and can be downloaded after the session ends.\n" + ] + }, + { + "cell_type": "markdown", + "id": "63790cec", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "# @title Step 19 — Save & fuse LoRA weights\n", + "\n", + "Saves LoRA adapters to `/kaggle/working/timps-coder-v4-adapters`,\n", + "then fuses them into the base model and writes the merged model to\n", + "`/kaggle/working/timps-coder-v4-fused`.\n", + "\n", + "On Kaggle we skip Google Drive mounting (Kaggle's persistent storage replaces it).\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e7de848b", + "metadata": {}, + "outputs": [], + "source": [ + "import os, gc, shutil, glob\n", + "import torch\n", + "\n", + "def _free_gb(path=\"/kaggle/working\"):\n", + " total, used, free = shutil.disk_usage(path)\n", + " return free / 1e9\n", + "\n", + "def _clear_disk_before_fuse():\n", + " \"\"\"Reclaim space before the fuse step, which needs to download a fresh\n", + " fp16 copy of the base model (~15GB) on top of the ~15GB merged output\n", + " it then writes. This is the exact step that ran out of space last time.\"\"\"\n", + " freed_from = []\n", + "\n", + " # 1. Drop pip's download cache (can be several GB after installing\n", + " # torch/unsloth/transformers/trl/bitsandbytes etc).\n", + " try:\n", + " import subprocess\n", + " subprocess.run([\"pip\", \"cache\", \"purge\"], capture_output=True, timeout=60)\n", + " freed_from.append(\"pip cache\")\n", + " except Exception:\n", + " pass\n", + "\n", + " # 2. Prune earlier-phase training checkpoints (SFT/GRPO/DPO). By the time\n", + " # we're fusing, only the final LoRA adapter state (already in the\n", + " # live `model` object, about to be saved to ADAPTER_DIR) matters —\n", + " # the intermediate phase checkpoints were only needed for cross-session\n", + " # resume, which is moot once we're at the publish step.\n", + " for sub in (\"sft-warmup\", \"grpo\", \"dpo\"):\n", + " p = f\"{OUTPUT_DIR}/{sub}\"\n", + " if os.path.isdir(p):\n", + " shutil.rmtree(p, ignore_errors=True)\n", + " freed_from.append(sub)\n", + "\n", + " # 3. Stale/partial HuggingFace hub downloads (e.g. a half-downloaded\n", + " # base model shard from a previous crashed attempt).\n", + " hf_cache = os.path.expanduser(\"~/.cache/huggingface/hub\")\n", + " for incomplete in glob.glob(f\"{hf_cache}/**/*.incomplete\", recursive=True):\n", + " try:\n", + " os.remove(incomplete)\n", + " except OSError:\n", + " pass\n", + "\n", + " gc.collect()\n", + " torch.cuda.empty_cache()\n", + "\n", + " if freed_from:\n", + " print(f\" Cleared: {', '.join(freed_from)}\")\n", + "\n", + "print(f\"Free disk before cleanup: {_free_gb():.1f} GB\")\n", + "_clear_disk_before_fuse()\n", + "print(f\"Free disk after cleanup : {_free_gb():.1f} GB\")\n", + "\n", + "# -- Save LoRA adapters to /kaggle/working (small, cheap, do this first so\n", + "# the adapters are safe on disk even if the fuse step below fails) --\n", + "print(\"\\nSaving LoRA adapter weights...\")\n", + "model.save_pretrained(ADAPTER_DIR)\n", + "tokenizer.save_pretrained(ADAPTER_DIR)\n", + "print(f\" Adapters saved locally: {ADAPTER_DIR}\")\n", + "\n", + "# -- Preflight check: fusing needs room for the fp16 base download (~15GB)\n", + "# plus the merged output (~15GB) — refuse to start rather than crash\n", + "# halfway through a multi-GB write like last time. --\n", + "_free = _free_gb()\n", + "_needed = 32 # ~15GB re-download + ~15GB merged output + headroom\n", + "FUSE_SUCCEEDED = False\n", + "if _free < _needed:\n", + " print(f\"\\n Only {_free:.1f} GB free, need ~{_needed} GB to fuse safely.\")\n", + " print(\" Skipping local fuse to avoid a mid-write crash. Your LoRA adapters\")\n", + " print(f\" are already saved at {ADAPTER_DIR} — you can still publish those,\")\n", + " print(\" or free more space (delete timps-coder-v4-gguf/ if present, or\")\n", + " print(\" commit+restart the Kaggle session) and re-run this cell.\")\n", + "else:\n", + " print(f\"\\n {_free:.1f} GB free — proceeding with fuse.\")\n", + " print(\"Fusing LoRA weights into base model...\")\n", + " try:\n", + " model.save_pretrained_merged(FUSED_DIR, tokenizer)\n", + " print(f\" Fused model saved to {FUSED_DIR}\")\n", + " print(f\" (LoRA merged into base — ready for deployment)\")\n", + " FUSE_SUCCEEDED = True\n", + " except OSError as e:\n", + " print(f\" Fuse failed with OSError: {e}\")\n", + " print(f\" Free disk at failure: {_free_gb():.1f} GB\")\n", + " print(f\" Your LoRA adapters are still safe at {ADAPTER_DIR}.\")\n", + " print(\" Free up more disk (see Step 21 note) and re-run this cell —\")\n", + " print(\" it will skip the adapter-save (already done) and retry the fuse.\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "f24f28cc", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "# @title Step 20 — Upload to HuggingFace Hub\n", + "\n", + "Pushes the fused model to `sandeeprdy1729/TIMPS-Coder-7B` and the LoRA adapters\n", + "to `sandeeprdy1729/TIMPS-Coder-7B-Adapters`.\n", + "\n", + "Change `HF_USERNAME` / `HF_REPO` at the top of this cell if you want to push to your own\n", + "account. The HF_TOKEN Kaggle Secret (Step 3) must be set with write permission.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4190cc6a", + "metadata": {}, + "outputs": [], + "source": [ + "from huggingface_hub import HfApi, create_repo, upload_folder\n", + "\n", + "REPO_ID = HF_REPO # from Step 0\n", + "\n", + "# -- Create repo --\n", + "print(f\"Uploading to HuggingFace Hub: {REPO_ID}\")\n", + "api = HfApi()\n", + "\n", + "try:\n", + " create_repo(REPO_ID, repo_type=\"model\", exist_ok=True)\n", + " print(f\" Repo created/confirmed: {REPO_ID}\")\n", + "except Exception as e:\n", + " print(f\" Repo creation: {e}\")\n", + "\n", + "# -- Write Model Card --\n", + "MODEL_CARD = \"\"\"---\n", + "license: apache-2.0\n", + "language:\n", + "- en\n", + "base_model: Qwen/Qwen2.5-Coder-7B-Instruct\n", + "tags:\n", + "- code\n", + "- coding-agent\n", + "- grpo\n", + "- sgs\n", + "- tool-discipline\n", + "- qwen2.5\n", + "- unsloth\n", + "library_name: transformers\n", + "pipeline_tag: text-generation\n", + "---\n", + "\n", + "# TIMPS-Coder v4 — SGS + GRPO + Tool Discipline\n", + "\n", + "> 7B coding agent trained with Self-Guided Self-Play + Group Relative Policy Optimization + Tool Discipline\n", + "\n", + "Built by **Sandeep Reddy (TIMPS)** — trained on Kaggle GPU T4 x2.\n", + "\n", + "## Training Methodology\n", + "\n", + "TIMPS-Coder v4 uses a 4-step training pipeline:\n", + "\n", + "### Step 1: GRPO + Tool Discipline\n", + "- Group Relative Policy Optimization (from DeepSeek-R1)\n", + "- No critic model needed — more stable than PPO\n", + "- 3 reward functions: Correctness (50%), Tool Discipline (30%), Verification (20%)\n", + "\n", + "### Step 2: DPO Alignment\n", + "- Direct Preference Optimization on GRPO outputs\n", + "- Lower learning rate for fine-grained preference tuning\n", + "\n", + "### Step 3: SGS Self-Play\n", + "- Self-Guided Self-Play (arXiv 2604.20209v1)\n", + "- 3 roles: Solver (REINFORCE), Conjecturer (generates sub-problems), Guide (scores quality)\n", + "\n", + "### Step 4: Benchmarks + Deploy\n", + "- HumanEval, MBPP, LiveCodeBench evaluation\n", + "- HuggingFace Hub + Ollama deployment\n", + "\n", + "## Key Features\n", + "\n", + "- THINK→INSPECT→ACT→VERIFY protocol for every task\n", + "- 6 tool-aware capabilities: read_file, write_file, run_tests, check_linter, inspect_error, search_code\n", + "- ChatML format (Qwen2.5 compatible)\n", + "- Trained on: HumanEval, MBPP, SWE-bench, LeetCode, Agentic SFT data\n", + "\n", + "## Technical Details\n", + "\n", + "| Parameter | Value |\n", + "|-----------|-------|\n", + "| Base model | Qwen/Qwen2.5-Coder-7B-Instruct |\n", + "| Parameters | ~7B |\n", + "| LoRA rank | 64 (RSLoRA) |\n", + "| Training | Unsloth (2x faster, 60% less VRAM) |\n", + "| Quantization | 4-bit QLoRA during training, 16-bit merged |\n", + "| Max sequence length | 4096 |\n", + "| Format | ChatML (`<|im_start|>`, `<|im_end|>`) |\n", + "| Trained on | Kaggle GPU T4 x2 |\n", + "\n", + "## Usage\n", + "\n", + "```python\n", + "from transformers import AutoModelForCausalLM, AutoTokenizer\n", + "\n", + "model = AutoModelForCausalLM.from_pretrained(\"sandeeprdy1729/TIMPS-Coder-7B\")\n", + "tokenizer = AutoTokenizer.from_pretrained(\"sandeeprdy1729/TIMPS-Coder-7B\")\n", + "\n", + "messages = [\n", + " {\"role\": \"system\", \"content\": \"You are TIMPS-Coder v4, an elite coding agent.\"},\n", + " {\"role\": \"user\", \"content\": \"Fix this bug: ...\"},\n", + "]\n", + "inputs = tokenizer.apply_chat_template(messages, return_tensors=\"pt\", add_generation_prompt=True)\n", + "outputs = model.generate(inputs, max_new_tokens=1024, temperature=0.7)\n", + "print(tokenizer.decode(outputs[0], skip_special_tokens=True))\n", + "```\n", + "\n", + "## License\n", + "\n", + "Apache 2.0 — same as Qwen2.5-Coder base model.\n", + "\n", + "## Credits\n", + "\n", + "- **Qwen Team** — Qwen2.5-Coder base model\n", + "- **DeepSeek** — GRPO method (DeepSeek-R1)\n", + "- **Snorkel AI** — Tool Discipline insight\n", + "- **SGS Paper** (arXiv 2604.20209v1) — Self-Guided Self-Play\n", + "- **Unsloth** — Fast training framework\n", + "- **Sandeep Reddy (TIMPS)** — Training pipeline & model\n", + "\"\"\"\n", + "\n", + "# Write model card\n", + "with open(f\"{FUSED_DIR}/README.md\", \"w\") as f:\n", + " f.write(MODEL_CARD)\n", + "print(\" Model card written\")\n", + "\n", + "# -- Upload merged model (only if the fuse step in Step 19 actually succeeded) --\n", + "if globals().get(\"FUSE_SUCCEEDED\", False):\n", + " print(\"\\nUploading fused model to HuggingFace Hub...\")\n", + " try:\n", + " upload_folder(\n", + " repo_id=REPO_ID,\n", + " folder_path=FUSED_DIR,\n", + " repo_type=\"model\",\n", + " )\n", + " print(f\" Model uploaded to: https://huggingface.co/{REPO_ID}\")\n", + " except Exception as e:\n", + " print(f\" Upload error: {e}\")\n", + " print(f\" Try manually: upload_folder(repo_id='{REPO_ID}', folder_path='{FUSED_DIR}')\")\n", + "else:\n", + " print(\"\\nSkipping merged-model upload — Step 19 fuse did not complete\")\n", + " print(\"(likely ran out of disk). Adapters will still be uploaded below.\")\n", + "\n", + "# -- Also push adapters --\n", + "try:\n", + " adapters_repo = f\"{REPO_ID}-Adapters\"\n", + " create_repo(adapters_repo, repo_type=\"model\", exist_ok=True)\n", + " upload_folder(\n", + " repo_id=adapters_repo,\n", + " folder_path=ADAPTER_DIR,\n", + " repo_type=\"model\",\n", + " )\n", + " print(f\" Adapters uploaded to: https://huggingface.co/{adapters_repo}\")\n", + "except Exception as e:\n", + " print(f\" Adapters upload: {e}\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "e65cb942", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "# @title Step 21 — Convert to GGUF & create Ollama Modelfile\n", + "\n", + "Builds a Q4_K_M GGUF file under `/kaggle/working/timps-coder-v4-gguf` using llama.cpp.\n", + "Also writes an Ollama `Modelfile` you can use locally after downloading the GGUF.\n", + "\n", + "> The Ollama push step is **optional** — `ollama` is not installed on Kaggle by default.\n", + "> Run that step locally after downloading the GGUF from Kaggle's Output tab.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ceb5e378", + "metadata": {}, + "outputs": [], + "source": [ + "# -- Convert to GGUF using llama.cpp (optional — controlled by DO_GGUF_CONVERSION) --\n", + "# GGUF format enables fast local inference with Ollama, LM Studio, etc.\n", + "# This step needs real disk headroom on top of everything already written\n", + "# (F16 GGUF ~14GB + Q4_K_M ~4.5GB), so it's guarded: it only runs if the fuse\n", + "# in Step 19 actually succeeded, there's enough free space, and the whole\n", + "# thing is wrapped so a failure here can't crash the rest of the notebook —\n", + "# it's a nice-to-have, not required to publish to HuggingFace.\n", + "\n", + "import os, subprocess, sys, shutil\n", + "from pathlib import Path\n", + "\n", + "def _free_gb(path=\"/kaggle/working\"):\n", + " total, used, free = shutil.disk_usage(path)\n", + " return free / 1e9\n", + "\n", + "GGUF_SUCCEEDED = False\n", + "\n", + "if not DO_GGUF_CONVERSION:\n", + " print(\"DO_GGUF_CONVERSION is False — skipping GGUF/Ollama export.\")\n", + " print(\"Your HF model + LoRA adapters (Steps 19-20) are unaffected.\")\n", + "elif not globals().get(\"FUSE_SUCCEEDED\", False):\n", + " print(\"Skipping GGUF conversion — Step 19 fuse did not produce a local\")\n", + " print(f\"merged model at {FUSED_DIR}, so there's nothing to convert.\")\n", + "else:\n", + " _needed = 20 # ~14GB F16 + ~4.5GB Q4 + headroom\n", + " _free = _free_gb()\n", + " if _free < _needed:\n", + " print(f\"Only {_free:.1f} GB free, need ~{_needed} GB for GGUF conversion.\")\n", + " print(\"Skipping GGUF export — your HF upload (Steps 19-20) already succeeded,\")\n", + " print(\"this step only affects local Ollama/llama.cpp usage.\")\n", + " else:\n", + " try:\n", + " print(f\"Free disk: {_free:.1f} GB — proceeding with GGUF conversion.\")\n", + " print(\"Converting to GGUF format...\")\n", + "\n", + " # Clone llama.cpp for conversion\n", + " subprocess.run([\"git\", \"clone\", \"https://github.com/ggerganov/llama.cpp.git\"],\n", + " capture_output=True, timeout=300)\n", + "\n", + " # Install the Python conversion deps (convert_hf_to_gguf.py needs these)\n", + " subprocess.run([\"pip\", \"install\", \"-e\", \"llama.cpp\"], capture_output=True, timeout=300)\n", + " subprocess.run([\"pip\", \"install\", \"-r\", \"llama.cpp/requirements.txt\"],\n", + " capture_output=True, timeout=300)\n", + "\n", + " # Build the C++ tools (llama-quantize) — needed for Q4_K_M quantization\n", + " print(\"Building llama-quantize (this takes ~2-3 min)...\")\n", + " build_result = subprocess.run(\n", + " [\"make\", \"-C\", \"llama.cpp\", \"llama-quantize\", \"-j4\"],\n", + " capture_output=True, text=True, timeout=600\n", + " )\n", + " if build_result.returncode == 0:\n", + " print(\" llama-quantize built successfully\")\n", + " else:\n", + " print(f\" Build via make failed: {build_result.stderr[-400:]}\")\n", + " print(\" Trying cmake fallback...\")\n", + " os.makedirs(\"llama.cpp/build\", exist_ok=True)\n", + " subprocess.run(\n", + " [\"cmake\", \"-S\", \"llama.cpp\", \"-B\", \"llama.cpp/build\", \"-DLLAMA_QUANTIZE=ON\"],\n", + " capture_output=True, text=True, timeout=300\n", + " )\n", + " make_result = subprocess.run(\n", + " [\"cmake\", \"--build\", \"llama.cpp/build\", \"--target\", \"llama-quantize\", \"-j4\"],\n", + " capture_output=True, text=True, timeout=600\n", + " )\n", + " if make_result.returncode == 0:\n", + " subprocess.run([\"cp\", \"llama.cpp/build/bin/llama-quantize\", \"llama.cpp/llama-quantize\"],\n", + " check=False)\n", + " print(\" llama-quantize built via cmake\")\n", + " else:\n", + " print(f\" cmake fallback also failed: {make_result.stderr[-400:]}\")\n", + " print(\" Will skip Q4_K_M quantization; F16 GGUF (if conversion succeeds) is still usable.\")\n", + "\n", + " fused_dir = Path(FUSED_DIR)\n", + " gguf_dir = Path(GGUF_DIR)\n", + " gguf_dir.mkdir(exist_ok=True)\n", + "\n", + " print(\"\\nConverting safetensors to GGUF (F16)...\")\n", + " convert_script = \"llama.cpp/convert_hf_to_gguf.py\"\n", + " if not os.path.exists(convert_script):\n", + " convert_script = \"llama.cpp/convert/convert_hf_to_gguf.py\"\n", + "\n", + " convert_result = subprocess.run(\n", + " [sys.executable, convert_script,\n", + " str(fused_dir), \"--outfile\", str(gguf_dir / \"model-f16.gguf\"), \"--outtype\", \"f16\"],\n", + " capture_output=True, text=True, timeout=900\n", + " )\n", + "\n", + " if convert_result.returncode == 0:\n", + " print(\" F16 GGUF conversion successful\")\n", + " f16_size = os.path.getsize(gguf_dir / \"model-f16.gguf\") / 1e9\n", + " print(f\" F16 file size: {f16_size:.1f} GB\")\n", + " else:\n", + " print(f\" F16 conversion stderr: {convert_result.stderr[:1000]}\")\n", + " print(\" Trying alternative: install gguf python pkg and retry\")\n", + " subprocess.run([\"pip\", \"install\", \"-q\", \"gguf\"], capture_output=True, timeout=180)\n", + " convert_result2 = subprocess.run(\n", + " [sys.executable, convert_script,\n", + " str(fused_dir), \"--outfile\", str(gguf_dir / \"model-f16.gguf\"), \"--outtype\", \"f16\"],\n", + " capture_output=True, text=True, timeout=900\n", + " )\n", + " if convert_result2.returncode == 0:\n", + " print(\" F16 GGUF conversion successful (retry)\")\n", + " else:\n", + " print(f\" Retry failed: {convert_result2.stderr[:500]}\")\n", + " print(\" Skip GGUF step — your fused HF model is still usable via transformers/Ollama-from-HF.\")\n", + "\n", + " # -- Quantize to Q4_K_M (recommended for 7B) --\n", + " quantize_bin = \"llama.cpp/llama-quantize\"\n", + " quantized_ok = False\n", + " if os.path.exists(gguf_dir / \"model-f16.gguf\") and os.path.exists(quantize_bin):\n", + " print(\"\\nQuantizing to Q4_K_M (4-bit, best quality/speed tradeoff)...\")\n", + " quant_result = subprocess.run(\n", + " [quantize_bin,\n", + " str(gguf_dir / \"model-f16.gguf\"),\n", + " str(gguf_dir / \"model-Q4_K_M.gguf\"),\n", + " \"Q4_K_M\"],\n", + " capture_output=True, text=True, timeout=1800\n", + " )\n", + " if quant_result.returncode == 0:\n", + " print(\" Q4_K_M quantization successful\")\n", + " q4_size = os.path.getsize(gguf_dir / \"model-Q4_K_M.gguf\") / 1e9\n", + " print(f\" Q4_K_M file size: {q4_size:.1f} GB\")\n", + " quantized_ok = True\n", + " else:\n", + " print(f\" Quantization error: {quant_result.stderr[:500]}\")\n", + " elif not os.path.exists(quantize_bin):\n", + " print(\"\\nSkipping Q4_K_M quantization (llama-quantize binary not built).\")\n", + " else:\n", + " print(\"\\nSkipping Q4_K_M quantization (F16 GGUF conversion failed).\")\n", + "\n", + " # -- Reclaim disk: once Q4_K_M exists, the 14GB F16 intermediate\n", + " # is no longer needed (Q4_K_M is what Ollama/llama.cpp actually use).\n", + " if quantized_ok and os.path.exists(gguf_dir / \"model-f16.gguf\"):\n", + " os.remove(gguf_dir / \"model-f16.gguf\")\n", + " print(\" Removed F16 intermediate (14GB) — Q4_K_M is the deployable file.\")\n", + "\n", + " # -- Create Ollama Modelfile --\n", + " print(\"\\nCreating Ollama Modelfile...\")\n", + " MODELFILE = \"\"\"FROM ./model-Q4_K_M.gguf\n", + "\n", + "TEMPLATE \\\"\\\"\\\"{{- if .System }}<|im_start|>system\n", + "{{ .System }}<|im_end|>\n", + "{{- end }}\n", + "<|im_start|>user\n", + "{{ .Prompt }}<|im_end|>\n", + "<|im_start|>assistant\n", + "{{ .Response }}<|im_end|>\\\"\\\"\\\"\n", + "\n", + "PARAMETER stop \"<|im_end|>\"\n", + "PARAMETER stop \"<|im_start|>\"\n", + "PARAMETER temperature 0.7\n", + "PARAMETER top_p 0.95\n", + "PARAMETER num_ctx 4096\n", + "\n", + "SYSTEM \\\"\\\"\\\"You are TIMPS-Coder v4, an elite coding agent built by Sandeep Reddy (TIMPS).\n", + "\n", + "You are trained with SGS + GRPO + Tool Discipline.\n", + "\n", + "For every task, follow: THINK -> INSPECT -> ACT -> VERIFY\n", + "\n", + "Specializations:\n", + "- Real GitHub issue resolution with precise patches\n", + "- Agentic code editing: multi-step reasoning + tool use\n", + "- Repository navigation and root-cause analysis\n", + "- Competitive algorithm problem solving\n", + "\n", + "Always inspect before acting. Read the code, understand the error, THEN write your fix.\\\"\\\"\\\"\n", + "\"\"\"\n", + " with open(gguf_dir / \"Modelfile\", \"w\") as f:\n", + " f.write(MODELFILE)\n", + " print(\" Modelfile created\")\n", + "\n", + " OLLAMA_MODEL = \"sandeeprdy1729/timps-coder-v4\"\n", + " print(f\"\\nAfter downloading the GGUF, run locally:\")\n", + " print(f\" ollama create {OLLAMA_MODEL} -f Modelfile\")\n", + " print(f\" ollama push {OLLAMA_MODEL}\")\n", + "\n", + " GGUF_SUCCEEDED = True\n", + " print(f\"\\nGGUF conversion step complete!\")\n", + " print(f\" Q4_K_M : {gguf_dir / 'model-Q4_K_M.gguf'}\")\n", + " print(f\" Modelfile : {gguf_dir / 'Modelfile'}\")\n", + "\n", + " # -- Reclaim the big local FUSED_DIR (~15GB) now that it's both\n", + " # uploaded to HF (Step 20) and converted to GGUF above. --\n", + " if os.path.isdir(FUSED_DIR):\n", + " shutil.rmtree(FUSED_DIR, ignore_errors=True)\n", + " print(f\" Removed local {FUSED_DIR} (already on HF + converted to GGUF).\")\n", + "\n", + " except Exception as e:\n", + " print(f\"GGUF conversion hit an unexpected error and was skipped: {e}\")\n", + " print(\"This does not affect your HF upload from Steps 19-20 — only local\")\n", + " print(\"Ollama/llama.cpp export was skipped.\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "1aee1423", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "source": [ + "---\n", + "# FINAL SUMMARY & KAGGLE OUTPUT GUIDE\n", + "\n", + "TIMPS-Coder v4 — SGS + GRPO + Tool Discipline Training Pipeline\n", + "\n", + "## What's saved in `/kaggle/working/` (your Kaggle Output)\n", + "\n", + "After the full pipeline runs, the following files appear under the **Output** tab of your\n", + "Kaggle notebook (and can be downloaded individually or as a single zip):\n", + "\n", + "```\n", + "/kaggle/working/\n", + "├── timps-coder-v4/ # training checkpoints\n", + "│ ├── sft-warmup/ # SFT intermediate checkpoints\n", + "│ ├── grpo/ # GRPO intermediate checkpoints\n", + "│ └── dpo/ # DPO intermediate checkpoints\n", + "├── timps-coder-v4-adapters/ # final LoRA adapters ( safetensors )\n", + "├── timps-coder-v4-fused/ # fused 16-bit model ( HF format )\n", + "│ └── README.md # model card (auto-pushed to HF)\n", + "├── timps-coder-v4-gguf/ # GGUF files for Ollama / llama.cpp\n", + "│ ├── model-f16.gguf # ~14 GB F16\n", + "│ ├── model-Q4_K_M.gguf # ~4.5 GB Q4_K_M\n", + "│ └── Modelfile # Ollama Modelfile\n", + "├── codeqa_workspace/ # sandbox for tool-discipline training\n", + "├── dpo_pairs.json # DPO preference pairs (reusable)\n", + "├── sgs_results.json # SGS self-play trace\n", + "└── humaneval_predictions.jsonl # HumanEval predictions for evalplus\n", + "```\n", + "\n", + "## How to download from Kaggle\n", + "\n", + "1. After the notebook finishes, go to the notebook's page on kaggle.com.\n", + "2. Click the **Output** tab in the right sidebar (or scroll to the bottom of the notebook).\n", + "3. Each file / folder under `/kaggle/working/` is listed there.\n", + "4. Click any file to download it individually, or click **Download All** for a zip.\n", + "\n", + "## How to continue training across multiple Kaggle sessions\n", + "\n", + "Kaggle sessions are limited to 12h each, but `/kaggle/working/` persists between sessions\n", + "**only if you commit and re-open the notebook**. To resume:\n", + "\n", + "1. After each major step (SFT, GRPO, DPO, SGS), commit the notebook.\n", + "2. Re-open the committed version — `/kaggle/working/` contents from the previous run are\n", + " available under `/kaggle/working/` automatically (Output is re-mounted as input on rerun).\n", + "3. Skip steps whose checkpoints already exist (wrap each cell in `if not os.path.exists(...)`).\n", + "\n", + "If you want true cross-session resume, push intermediate checkpoints to HuggingFace Hub\n", + "after each phase and re-download them in the next session.\n", + "\n", + "---\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "13322e35", + "metadata": { + "papermill": { + "duration": null, + "end_time": null, + "exception": null, + "start_time": null, + "status": "pending" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "print(\"\"\"\n", + "╔══════════════════════════════════════════════════════════════════════════╗\n", + "║ ║\n", + "║ 🎉 TIMPS-Coder v4 — Training Complete! ║\n", + "║ ║\n", + "║ 4-Step Pipeline: SGS + GRPO + Tool Discipline ║\n", + "║ ║\n", + "╠══════════════════════════════════════════════════════════════════════════╣\n", + "║ ║\n", + "║ Step 1: ✅ GRPO + Tool Discipline ║\n", + "║ - 3 reward functions: Correctness, Discipline, Verification ║\n", + "║ - Group Relative Policy Optimization (DeepSeek-R1 method) ║\n", + "║ - Snorkel AI insight: inspect before act ║\n", + "║ ║\n", + "║ Step 2: ✅ DPO Alignment ║\n", + "║ - Preference optimization on GRPO outputs ║\n", + "║ - Teaches model to prefer correct + disciplined completions ║\n", + "║ ║\n", + "║ Step 3: ✅ SGS Self-Play ║\n", + "║ - Solver + Conjecturer + Guide (arXiv 2604.20209v1) ║\n", + "║ - 7B model trained like 671B via self-guided curriculum ║\n", + "║ - Test suite = verifier (adapted from theorem proving) ║\n", + "║ ║\n", + "║ Step 4: ✅ Benchmarks + Deploy ║\n", + "║ - HumanEval, MBPP, LiveCodeBench evaluation ║\n", + "║ - HuggingFace Hub: sandeeprdy1729/TIMPS-Coder-7B ║\n", + "║ - Ollama: sandeeprdy1729/timps-coder-v4 ║\n", + "║ ║\n", + "╠══════════════════════════════════════════════════════════════════════════╣\n", + "║ ║\n", + "║ 📊 Model Details: ║\n", + "║ - Base: Qwen/Qwen2.5-Coder-7B-Instruct ║\n", + "║ - LoRA: rank=64, RSLoRA, all linear layers ║\n", + "║ - Max sequence: 4096 tokens ║\n", + "║ - Format: ChatML (<|im_start|>/<|im_end|>) ║\n", + "║ - Protocol: THINK → INSPECT → ACT → VERIFY ║\n", + "║ ║\n", + "║ 🔗 Links: ║\n", + "║ - HuggingFace: https://huggingface.co/sandeeprdy1729/TIMPS-Coder-7B ║\n", + "║ - Ollama: ollama run sandeeprdy1729/timps-coder-v4 ║\n", + "║ ║\n", + "║ 🧠 Key Papers: ║\n", + "║ - SGS: arXiv 2604.20209v1 (7B beats 671B) ║\n", + "║ - GRPO: DeepSeek-R1 (no critic model, group-relative) ║\n", + "║ - Tool Discipline: Snorkel AI (4B beats 235B) ║\n", + "║ ║\n", + "║ 👤 Author: Sandeep Reddy (TIMPS) ║\n", + "║ ║\n", + "╚══════════════════════════════════════════════════════════════════════════╝\n", + "\"\"\")\n" + ] + } + ], + "metadata": { + "kaggle": { + "accelerator": "gpu-t4-x2", + "dataSources": [], + "isGpuEnabled": true, + "isInternetEnabled": true, + "kernelManagerId": "kaggle-user", + "language": "python", + "sourceType": "notebook" + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.13" + }, + "papermill": { + "default_parameters": {}, + "duration": null, + "end_time": null, + "environment_variables": {}, + "exception": null, + "input_path": "__notebook__.ipynb", + "output_path": "__notebook__.ipynb", + "parameters": {}, + "start_time": "2026-06-28T01:03:49.256371+00:00", + "version": "2.7.0" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "state": { + "02d8ec7a356b40b687dd33a36bbcb68e": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_344cd0c600044103849f4e656464a091", + "placeholder": "​", + "style": "IPY_MODEL_b331f05e91b3431aa0431f0c9f4f5a18", + "tabbable": null, + "tooltip": null, + "value": " 665/665 [00:00<00:00, 73.4kB/s]" + } + }, + "0395e3812ba24f2b9ebc17485fa58437": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "05aba5434ed0466dbb8c160b88eded1b": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_3e50178b631b41b0998fab4e8c97776a", + "placeholder": "​", + "style": "IPY_MODEL_22e0d8d060234794a0b27b59a0680a53", + "tabbable": null, + "tooltip": null, + "value": " 632/632 [00:00<00:00, 64.5kB/s]" + } + }, + "05ed221bf5ba4dec927e633e1e19110f": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_633be4b9c68d441e9275634d197e76b3", + "IPY_MODEL_2abad561eb734b8ea2bdb1e3fe18ad72", + "IPY_MODEL_ce6d1ee6cf81425cb7b6951ce530d34e" + ], + "layout": "IPY_MODEL_d63ecee969ab462590aa00a8c963c4d1", + "tabbable": null, + "tooltip": null + } + }, + "07fbee2dd375407a8e0aba5d0932c1d4": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "09afba4727924448983c0aa091a91ed4": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "0c2d83738cfb44829888a8bcc84274a4": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "0c7ac202e53c418586224da0a225a8e2": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "0c8e62f2570c47be88f66afbfa755248": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_1d77f229dc1744b3a4d5084877d69860", + "placeholder": "​", + "style": "IPY_MODEL_b4f0a16677b94b42b19466e9dcdbbacc", + "tabbable": null, + "tooltip": null, + "value": "openai_humaneval/test-00000-of-00001.par(…): 100%" + } + }, + "0d01ea6df00d4345bb924e304f344fd8": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_8b49986b1f9c4d529ccc45bfe774389c", + "placeholder": "​", + "style": "IPY_MODEL_cbfb1c98b9024eea8f0189a406549086", + "tabbable": null, + "tooltip": null, + "value": " 1.25k/? [00:00<00:00, 93.7kB/s]" + } + }, + "0e517ea9eb5c48c2aa457389650f77e8": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "0fec126ff9694bf68fe9dce8b20492d0": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "0ff65d8764014fedb4625e377053e10a": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "0ffba08ffb8f43248ca2207e36e20350": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "12389d5818c744e9baa2feca734d26a1": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "143a8e8e36ea4666b27acd3aa669304d": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_2326fdd2f2614c1285f576fc199f1b42", + "IPY_MODEL_ea1911017af1498782ab1809a9ebfadb", + "IPY_MODEL_ef02190a0da544a5bf6b94ea3b084f2e" + ], + "layout": "IPY_MODEL_a7028888c2bf42cea1f04274e7fc6b1c", + "tabbable": null, + "tooltip": null + } + }, + "14d9317c6a294421886ecab3dff3aee7": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_3c5c8e93c810475e89aaed7555ba9102", + "IPY_MODEL_89951752172a407a941e84134a4f2323", + "IPY_MODEL_1d9e0d4894d9465fb14bb2ec27273e1b" + ], + "layout": "IPY_MODEL_88dc7a14a7a1495eab116822e7d34077", + "tabbable": null, + "tooltip": null + } + }, + "15b2831a8acf44478a0d3dbeb44b93ab": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_bea90ad05cc34676aa005a2bf3e58b85", + "max": 2096679, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_73f64ec5466f4a9683a2e1494eab3eea", + "tabbable": null, + "tooltip": null, + "value": 2096679 + } + }, + "16b84a08884c464899aa25c22618db2e": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "16bc0ccc64524e87897f7584166b17c0": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "16ec5ecef4644209b32a044c633e8a52": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "17d290530cbf454da8644fa28d642085": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_6101511927f244e7ae8345d533fc1fab", + "placeholder": "​", + "style": "IPY_MODEL_3bd4f8958ef0474f8ac1866ff77e4ae7", + "tabbable": null, + "tooltip": null, + "value": "Resolving data files: 100%" + } + }, + "1806856b0490424bad55dc568d3b9708": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "19e5746ffe894065949f47fbcbbe1979": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_9c99f7da0b4940f3ab820a112233b43d", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_0fec126ff9694bf68fe9dce8b20492d0", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "1a4476b268f5479ebcae60706c572bdf": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_e55cc58325bb4eefa954c794823f84a6", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_c3f9b0c015634294a76455c9ebf5b48f", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "1b3e1cd03d584f199e6c6953d8ecbb54": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_7b5efd1d3fa648f0b79da171c8af3bae", + "IPY_MODEL_5e59906194cf4ca1b8e74bf96c4d48b9", + "IPY_MODEL_850f0c4f0bec46e3b10ae04ac0a27fe4" + ], + "layout": "IPY_MODEL_489fbee8a75645169a3dab2e7218889b", + "tabbable": null, + "tooltip": null + } + }, + "1c4cc3d5abf340e0a8c59bb07aea21a8": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1c6ee9dc09b845bc8052f9ea0744d04c": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1c9a499ff4b641ad8c29e13c3b5bf946": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1d77f229dc1744b3a4d5084877d69860": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1d9e0d4894d9465fb14bb2ec27273e1b": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_5c199255f8344f988982f54a88970aaf", + "placeholder": "​", + "style": "IPY_MODEL_33133bb603164cb192afe0cdb9d4c9cf", + "tabbable": null, + "tooltip": null, + "value": " 3.34k/? [00:00<00:00, 344kB/s]" + } + }, + "1da3b41dc79b42d4a86aaa45b8ad54a4": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_ec26fe9dbf934a05abc4a1f1ce374f99", + "IPY_MODEL_802e247b68d94cdb9555ca77dac125c8", + "IPY_MODEL_8beaf833b4154dd8ad14bb03fc80476a" + ], + "layout": "IPY_MODEL_55c6da36584d41cab593320d592f01d0", + "tabbable": null, + "tooltip": null + } + }, + "1deaa932ecfc4272a223624a2ae9b5de": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1e96c6e2c93a42959619c7ca399c8a93": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_b0e84209f7604c3db2fe4f7e2e24ebab", + "placeholder": "​", + "style": "IPY_MODEL_d16551a17dbf4e5ab902b07b56e1c8f9", + "tabbable": null, + "tooltip": null, + "value": " 2.10M/2.10M [00:00<00:00, 9.33MB/s]" + } + }, + "1f62ccb96ece4ba1bd2bf2b7a78e7d1d": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1fda7f61ebac4fd59494b1efafddf4ed": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_536f4f8f08ce464db0ad9b82a8db0a55", + "max": 265, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_21f5adf3204042a68ed591baf404d8d0", + "tabbable": null, + "tooltip": null, + "value": 265 + } + }, + "2032e3b54123455db3e474b9c5d2757c": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "20adb4fc85f148ef9b580cc250c6d1d8": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "20d7d61ca5b44304ab0302398c355fa3": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_0ff65d8764014fedb4625e377053e10a", + "placeholder": "​", + "style": "IPY_MODEL_caaa672e7f0e41c689e2aedc61a91e90", + "tabbable": null, + "tooltip": null, + "value": " 1371/1371 [00:15<00:00, 103.03 examples/s]" + } + }, + "20f5cd5031ba4bd0a13f81e79395e7ee": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "21f5adf3204042a68ed591baf404d8d0": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "22e0d8d060234794a0b27b59a0680a53": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "22f55f822c1f477687db3b019bec40a0": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "2326fdd2f2614c1285f576fc199f1b42": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_f9fad5e5b63f45819bf724bb47d4845e", + "placeholder": "​", + "style": "IPY_MODEL_91dadc17dc754c9e9c98463f591d14fd", + "tabbable": null, + "tooltip": null, + "value": "Computing checksums: 100%" + } + }, + "2353243d97be4dd8b54c34c8d83e59b3": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_12389d5818c744e9baa2feca734d26a1", + "placeholder": "​", + "style": "IPY_MODEL_3902b895a6634ecb9f1d481ed891337b", + "tabbable": null, + "tooltip": null, + "value": " 613/613 [00:00<00:00, 55.2kB/s]" + } + }, + "23e04a006a27410f9c8f72e22e90bb35": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_e84163c9f9f7423f9699ee3128175a6f", + "IPY_MODEL_1fda7f61ebac4fd59494b1efafddf4ed", + "IPY_MODEL_c016fe5bd4284aaea0322b2282c771f4" + ], + "layout": "IPY_MODEL_c4cf5800803b47b384fa0935dc83481a", + "tabbable": null, + "tooltip": null + } + }, + "2921f9a997734756a52e11b05ba07365": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "2abad561eb734b8ea2bdb1e3fe18ad72": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_ea5bb7d0a2e74221bbc4627997e20025", + "max": 339, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_90c2c47ecbe54cbabdaaef37f1b2e47f", + "tabbable": null, + "tooltip": null, + "value": 339 + } + }, + "2c981621578343b0834b8890c8f9ac00": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "2d45baebafd34e1db080ace860b2ee50": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "2d6682f461014dc292303a40c99d4dfe": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_79f538f4772c40f59164c873e74ea19a", + "max": 500, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_accb2a8b75ff402ca2e9dfd1d218dd9c", + "tabbable": null, + "tooltip": null, + "value": 500 + } + }, + "2e8fc98a2c6f47fcbc248c7b3dea2ca6": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_ef232c2eadeb45f69a35cd6fecbf6ccd", + "placeholder": "​", + "style": "IPY_MODEL_a13b092dcd9a4142a539fa73435755f8", + "tabbable": null, + "tooltip": null, + "value": "tokenizer.json: " + } + }, + "2f4a2b63407b4d5b9021ff395119bfbb": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_5dfce204a59748c18355a283c8254a05", + "IPY_MODEL_67676fb0c80f466b9505fce8d4eb5125", + "IPY_MODEL_02d8ec7a356b40b687dd33a36bbcb68e" + ], + "layout": "IPY_MODEL_3fd5383ca95642ad8fdefae6bcc1f708", + "tabbable": null, + "tooltip": null + } + }, + "2fcb73ac60d24fe4a15ac03cf8e5ace1": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_c235a89aaf2e4a1fa7f8a9b9251866e5", + "max": 613, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_ff2f7e13305e40e5899988f584357d59", + "tabbable": null, + "tooltip": null, + "value": 613 + } + }, + "30c0e62701304a329c4815647ae23b1f": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "3295e6840d42403b96cbe1eb8a5b26b1": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "33133bb603164cb192afe0cdb9d4c9cf": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "344cd0c600044103849f4e656464a091": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "346d15cbf2414d1cbba91de6ecfd5f62": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "35eb03e850d54545a42375819dcf3905": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "362b04347cc44c1e87383ab76c53a695": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_ced9eb5361ea4544a3353e6795ab4748", + "placeholder": "​", + "style": "IPY_MODEL_20f5cd5031ba4bd0a13f81e79395e7ee", + "tabbable": null, + "tooltip": null, + "value": " 83.9k/83.9k [00:00<00:00, 420kB/s]" + } + }, + "3749de0723d147bfa19896df8b9a2a7c": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "37af40fc030748beba1da714188f43a9": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_0395e3812ba24f2b9ebc17485fa58437", + "max": 632, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_84338cd567a4444e8d52ed963c99a498", + "tabbable": null, + "tooltip": null, + "value": 632 + } + }, + "3902b895a6634ecb9f1d481ed891337b": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "3bd4f8958ef0474f8ac1866ff77e4ae7": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "3c5c8e93c810475e89aaed7555ba9102": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_82329a907c324c7186f33c13aa32c997", + "placeholder": "​", + "style": "IPY_MODEL_3d675815e650459591570abfac4433fb", + "tabbable": null, + "tooltip": null, + "value": "README.md: " + } + }, + "3d14ac7f692644eb89454650dd2dae1f": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_5bb39271f8ae47acbe6a5e1bc032bcb1", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_4e9502fbe0b5441aab3f652c2e26845e", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "3d5a3d499b9644428bd08c82ca5fbed3": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_41ef0f577c804db9a66a32a9d42a9f0e", + "placeholder": "​", + "style": "IPY_MODEL_b172dc909a374a80b6dc073551c7e092", + "tabbable": null, + "tooltip": null, + "value": "Unsloth: Tokenizing ["text"] (num_proc=8): 100%" + } + }, + "3d675815e650459591570abfac4433fb": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "3e3e826cd7c6447996bcaa0d60151e54": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "3e50178b631b41b0998fab4e8c97776a": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "3e8d3d4e1c6f4c3db0f1b6c87f2e1233": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_b1256f6314ff488c8a785ad87186fefd", + "max": 164, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_42303097f0f94c24b91f57e19b482500", + "tabbable": null, + "tooltip": null, + "value": 164 + } + }, + "3f1daeb1140c489a94cee551517bed35": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "3f68c588c2fb4ac6976ba3f763287f46": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "3f7dbc14960a4c1f83c504fed871c870": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_16bc0ccc64524e87897f7584166b17c0", + "placeholder": "​", + "style": "IPY_MODEL_ee45bf2d57a24250ba88e2edb060b41b", + "tabbable": null, + "tooltip": null, + "value": " 5.55G/5.55G [00:21<00:00, 684MB/s]" + } + }, + "3fd5383ca95642ad8fdefae6bcc1f708": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "41ef0f577c804db9a66a32a9d42a9f0e": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "41efab2c12174ee8af99242ea44c7560": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "42303097f0f94c24b91f57e19b482500": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "4492af2ef3644d9f92ee65620ef5e44b": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "45040783dd4c45c98f948ced425e85c7": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_bd80656cb338404c81efd5db34737157", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_3749de0723d147bfa19896df8b9a2a7c", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "4626f5b148024aac881ed03a0f5255aa": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_e02eef7123004f49a3833585ca8e7d63", + "placeholder": "​", + "style": "IPY_MODEL_22f55f822c1f477687db3b019bec40a0", + "tabbable": null, + "tooltip": null, + "value": "data/test-00000-of-00001.parquet: 100%" + } + }, + "462c6bdffc6849f39ac26fb783f9f48d": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "47ef65d8a1b348548e1eaabe4a6897dd": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_a3434a884f7f47eb83a4f0de5366f5a7", + "placeholder": "​", + "style": "IPY_MODEL_71b9cf0fb304482e81dd030dd3d69251", + "tabbable": null, + "tooltip": null, + "value": "added_tokens.json: 100%" + } + }, + "489fbee8a75645169a3dab2e7218889b": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "4b42b08ba7c04b1b96d8987f3115fb38": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "4b6bc0b5e99f434580ae27b78e49a451": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "4e9502fbe0b5441aab3f652c2e26845e": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "4f2f58a661a54c13b2d7e2eb3d56594c": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "518aa2a7d0e640c3a6d2275d02ec1a29": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "5270a56277534bf79b006c356bb0a692": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "536f4f8f08ce464db0ad9b82a8db0a55": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "553ca1b5d8444ba9bbda273c5f0b2921": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "55c6da36584d41cab593320d592f01d0": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "55ebe3eac126490595aa6c5d137c1cb0": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "56442e2a723c4d28b64166ebedd08c02": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_47ef65d8a1b348548e1eaabe4a6897dd", + "IPY_MODEL_37af40fc030748beba1da714188f43a9", + "IPY_MODEL_05aba5434ed0466dbb8c160b88eded1b" + ], + "layout": "IPY_MODEL_3f1daeb1140c489a94cee551517bed35", + "tabbable": null, + "tooltip": null + } + }, + "56cc23e172d74df6bad972c4de3179f0": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_9a99775e68ea48a9acd62a69682b8e2b", + "IPY_MODEL_ca29a375b504402089fec49a92dd344e", + "IPY_MODEL_3f7dbc14960a4c1f83c504fed871c870" + ], + "layout": "IPY_MODEL_2032e3b54123455db3e474b9c5d2757c", + "tabbable": null, + "tooltip": null + } + }, + "58a8e04df60e4da68ac966f1c109ca21": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "58e9317c91964a57b440569e71e32d3d": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "59294633289c4df8b81887e1d8cda00b": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "5bb39271f8ae47acbe6a5e1bc032bcb1": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "5c199255f8344f988982f54a88970aaf": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "5dfce204a59748c18355a283c8254a05": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_635b61d52a324447b50f3fbe4a09fe9e", + "placeholder": "​", + "style": "IPY_MODEL_68729b7c3ce14cc182cbcf330141a777", + "tabbable": null, + "tooltip": null, + "value": "README.md: 100%" + } + }, + "5e59906194cf4ca1b8e74bf96c4d48b9": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_d89d0facd4d54f1098f0013627ca641e", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_518aa2a7d0e640c3a6d2275d02ec1a29", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "6101511927f244e7ae8345d533fc1fab": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "627844bfdf834298937930f78d36c993": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "633be4b9c68d441e9275634d197e76b3": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_0c7ac202e53c418586224da0a225a8e2", + "placeholder": "​", + "style": "IPY_MODEL_dfc2c324d7fd4d51bda2b790102adbb9", + "tabbable": null, + "tooltip": null, + "value": "Loading weights: 100%" + } + }, + "635b61d52a324447b50f3fbe4a09fe9e": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "67676fb0c80f466b9505fce8d4eb5125": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_c1102dd1228c479091345ed81be516c7", + "max": 665, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_09afba4727924448983c0aa091a91ed4", + "tabbable": null, + "tooltip": null, + "value": 665 + } + }, + "68729b7c3ce14cc182cbcf330141a777": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "6b9c83c1a4e24bb2a22e019b6889bfdc": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "6c5c2c0fa2bb4d0e94f4f65f6bd43655": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "6f0e01266b50415db0c75344c25885ae": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_97858455694f47049f11cfea4c8e3dd9", + "placeholder": "​", + "style": "IPY_MODEL_58a8e04df60e4da68ac966f1c109ca21", + "tabbable": null, + "tooltip": null, + "value": " 6.52k/? [00:00<00:00, 489kB/s]" + } + }, + "71b9cf0fb304482e81dd030dd3d69251": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "7234b29a3a1e421eb593d3c2521f3363": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "72d0d3225d0d487a97285bdabf0d4bbe": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "73f64ec5466f4a9683a2e1494eab3eea": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "74f976c9b1094de28874128c330556d1": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "7766cdc6d8c044519c2d779620b21246": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_4b42b08ba7c04b1b96d8987f3115fb38", + "placeholder": "​", + "style": "IPY_MODEL_7eca16df19d54b2d847817735c47c2c5", + "tabbable": null, + "tooltip": null, + "value": "merges.txt: " + } + }, + "777913145e8142f4b9b6173a1595b367": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_c08f735baec84172bd6848cb6432ff87", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_a7a44c7f4f1b4e638f003bc19e6fa14e", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "7862cfe4dbbd4c08abf00fbfef8d2636": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_e9dbe58a0604481ca41927407d5b85b6", + "IPY_MODEL_3e8d3d4e1c6f4c3db0f1b6c87f2e1233", + "IPY_MODEL_7ecc7e5757364c278a1550dc447f7957" + ], + "layout": "IPY_MODEL_1c9a499ff4b641ad8c29e13c3b5bf946", + "tabbable": null, + "tooltip": null + } + }, + "7928d28022a24464bb6603581e7ea753": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "79f538f4772c40f59164c873e74ea19a": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "79fb07f48d5641489ab2c6cb390bef50": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_1deaa932ecfc4272a223624a2ae9b5de", + "placeholder": "​", + "style": "IPY_MODEL_74f976c9b1094de28874128c330556d1", + "tabbable": null, + "tooltip": null, + "value": " 7.03M/? [00:00<00:00, 118MB/s]" + } + }, + "7abe4e7f59014837b4dae82ba423cb38": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_bee2385ba9374a04b1937aa60a1132c1", + "placeholder": "​", + "style": "IPY_MODEL_c3585be81d2d480d912aa26d5e1815e3", + "tabbable": null, + "tooltip": null, + "value": "README.md: " + } + }, + "7b5efd1d3fa648f0b79da171c8af3bae": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_80b71b54372c448d987f53bd5c7adeb4", + "placeholder": "​", + "style": "IPY_MODEL_c4099e61027148ffa4f66a13cab7bdec", + "tabbable": null, + "tooltip": null, + "value": "vocab.json: " + } + }, + "7e5ef4dc77fb41f1a8608e96d25da024": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_ab8f8816baa84571bdef26f3dce82541", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_2d45baebafd34e1db080ace860b2ee50", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "7eca16df19d54b2d847817735c47c2c5": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "7ecc7e5757364c278a1550dc447f7957": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_1f62ccb96ece4ba1bd2bf2b7a78e7d1d", + "placeholder": "​", + "style": "IPY_MODEL_30c0e62701304a329c4815647ae23b1f", + "tabbable": null, + "tooltip": null, + "value": " 164/164 [00:00<00:00, 3011.29 examples/s]" + } + }, + "801279e51fbc4916aacaba0adc3be1ef": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "802e247b68d94cdb9555ca77dac125c8": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_c1c9d87d48d24e74a7314dd5916b1c40", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_6c5c2c0fa2bb4d0e94f4f65f6bd43655", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "80b71b54372c448d987f53bd5c7adeb4": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "81db6732f3bb4650a36fd3b7628f9a14": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "82329a907c324c7186f33c13aa32c997": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "82855c61d96544e5ac5273848404c7df": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_17d290530cbf454da8644fa28d642085", + "IPY_MODEL_93ac5e891a0b406b9fdd39e385ccb29d", + "IPY_MODEL_ac780bd75cc547638c9c1828de4f3096" + ], + "layout": "IPY_MODEL_55ebe3eac126490595aa6c5d137c1cb0", + "tabbable": null, + "tooltip": null + } + }, + "84338cd567a4444e8d52ed963c99a498": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "850f0c4f0bec46e3b10ae04ac0a27fe4": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_20adb4fc85f148ef9b580cc250c6d1d8", + "placeholder": "​", + "style": "IPY_MODEL_627844bfdf834298937930f78d36c993", + "tabbable": null, + "tooltip": null, + "value": " 2.78M/? [00:00<00:00, 38.9MB/s]" + } + }, + "88dc7a14a7a1495eab116822e7d34077": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "89951752172a407a941e84134a4f2323": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_9fe997d8de164b01817df70c16a7f386", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_0ffba08ffb8f43248ca2207e36e20350", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "89e769e82c0643f19a723b635ee05fde": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_be99600cb002459c847dd57f5ac3132f", + "placeholder": "​", + "style": "IPY_MODEL_2921f9a997734756a52e11b05ba07365", + "tabbable": null, + "tooltip": null, + "value": " 1/1 [00:00<00:00, 177.64it/s]" + } + }, + "8ac86a4c2534485e99473cfd58296904": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_3d5a3d499b9644428bd08c82ca5fbed3", + "IPY_MODEL_ff6ccc01482f46bdb8310d96230067b4", + "IPY_MODEL_20d7d61ca5b44304ab0302398c355fa3" + ], + "layout": "IPY_MODEL_58e9317c91964a57b440569e71e32d3d", + "tabbable": null, + "tooltip": null + } + }, + "8b49986b1f9c4d529ccc45bfe774389c": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "8beaf833b4154dd8ad14bb03fc80476a": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_7928d28022a24464bb6603581e7ea753", + "placeholder": "​", + "style": "IPY_MODEL_3295e6840d42403b96cbe1eb8a5b26b1", + "tabbable": null, + "tooltip": null, + "value": " 7.51k/? [00:00<00:00, 643kB/s]" + } + }, + "90c2c47ecbe54cbabdaaef37f1b2e47f": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "91b15acc4b8743adb5970061f623ece3": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "91dadc17dc754c9e9c98463f591d14fd": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "93ac5e891a0b406b9fdd39e385ccb29d": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_346d15cbf2414d1cbba91de6ecfd5f62", + "max": 20, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_41efab2c12174ee8af99242ea44c7560", + "tabbable": null, + "tooltip": null, + "value": 20 + } + }, + "976a9680bef541feae2f802b72b9df32": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_1c6ee9dc09b845bc8052f9ea0744d04c", + "placeholder": "​", + "style": "IPY_MODEL_3e3e826cd7c6447996bcaa0d60151e54", + "tabbable": null, + "tooltip": null, + "value": " 500/500 [00:00<00:00, 10297.22 examples/s]" + } + }, + "97858455694f47049f11cfea4c8e3dd9": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "9855ede2d613448a8f8b7fb1f6ab6289": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_e74824de4ae148a9a5cce7456de61ce6", + "IPY_MODEL_7e5ef4dc77fb41f1a8608e96d25da024", + "IPY_MODEL_0d01ea6df00d4345bb924e304f344fd8" + ], + "layout": "IPY_MODEL_ccd6de9aac1a4b269e25a9219cdda807", + "tabbable": null, + "tooltip": null + } + }, + "9899e30615e5433ab1d0f237e338cab5": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_1806856b0490424bad55dc568d3b9708", + "placeholder": "​", + "style": "IPY_MODEL_07fbee2dd375407a8e0aba5d0932c1d4", + "tabbable": null, + "tooltip": null, + "value": "Computing checksums: 100%" + } + }, + "98febc8ad16040bcad787918f12ff218": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_2e8fc98a2c6f47fcbc248c7b3dea2ca6", + "IPY_MODEL_1a4476b268f5479ebcae60706c572bdf", + "IPY_MODEL_79fb07f48d5641489ab2c6cb390bef50" + ], + "layout": "IPY_MODEL_c87fb6446189421aa805ac3999f72c19", + "tabbable": null, + "tooltip": null + } + }, + "9a99775e68ea48a9acd62a69682b8e2b": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_16b84a08884c464899aa25c22618db2e", + "placeholder": "​", + "style": "IPY_MODEL_d127679ed10a46f6ac817e6ea29ddefb", + "tabbable": null, + "tooltip": null, + "value": "model.safetensors: 100%" + } + }, + "9ab0f29e292c405482589938ce38dcea": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "9c99f7da0b4940f3ab820a112233b43d": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "9d592b79075d432b905fa462dd4e1d16": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "9fd3676fe0c0467fbc8bf5cab2d03afd": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "9fe997d8de164b01817df70c16a7f386": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "a13b092dcd9a4142a539fa73435755f8": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "a1a4cb2dbd864813b3f081133f340ee7": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "a3434a884f7f47eb83a4f0de5366f5a7": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "a4ce863c40f7451db3f5f6ba9090e922": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "a6c1a416f2b241ffb5c2b77e881b1e2d": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "a7028888c2bf42cea1f04274e7fc6b1c": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "a7a44c7f4f1b4e638f003bc19e6fa14e": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "a823cf08126d4bda9e86808b8c2674b0": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_801279e51fbc4916aacaba0adc3be1ef", + "placeholder": "​", + "style": "IPY_MODEL_9ab0f29e292c405482589938ce38dcea", + "tabbable": null, + "tooltip": null, + "value": "Generating test split: 100%" + } + }, + "a88df84670244523baaf6669c9adf949": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_5270a56277534bf79b006c356bb0a692", + "placeholder": "​", + "style": "IPY_MODEL_9fd3676fe0c0467fbc8bf5cab2d03afd", + "tabbable": null, + "tooltip": null, + "value": " 1.67M/? [00:00<00:00, 67.9MB/s]" + } + }, + "a91876d8ff66499fa1f37945a20eeaf1": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "ab8f8816baa84571bdef26f3dce82541": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "ac780bd75cc547638c9c1828de4f3096": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_1c4cc3d5abf340e0a8c59bb07aea21a8", + "placeholder": "​", + "style": "IPY_MODEL_3f68c588c2fb4ac6976ba3f763287f46", + "tabbable": null, + "tooltip": null, + "value": " 20/20 [00:00<00:00, 2177.39it/s]" + } + }, + "accb2a8b75ff402ca2e9dfd1d218dd9c": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "b0e84209f7604c3db2fe4f7e2e24ebab": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "b1256f6314ff488c8a785ad87186fefd": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "b172dc909a374a80b6dc073551c7e092": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "b1b73a2279974bc59dc33d9c0e290895": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_dd60190c540b41e49c6ef6514861a7eb", + "IPY_MODEL_19e5746ffe894065949f47fbcbbe1979", + "IPY_MODEL_6f0e01266b50415db0c75344c25885ae" + ], + "layout": "IPY_MODEL_81db6732f3bb4650a36fd3b7628f9a14", + "tabbable": null, + "tooltip": null + } + }, + "b2334e82636746718f289b4cd8e5b797": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_0c8e62f2570c47be88f66afbfa755248", + "IPY_MODEL_f36cf5b205e441c0969d160090763cf9", + "IPY_MODEL_362b04347cc44c1e87383ab76c53a695" + ], + "layout": "IPY_MODEL_babf4118f8e245aca816f5426b1735b2", + "tabbable": null, + "tooltip": null + } + }, + "b331f05e91b3431aa0431f0c9f4f5a18": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "b4f0a16677b94b42b19466e9dcdbbacc": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "babf4118f8e245aca816f5426b1735b2": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "bd80656cb338404c81efd5db34737157": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "be99600cb002459c847dd57f5ac3132f": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "bea90ad05cc34676aa005a2bf3e58b85": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "bee2385ba9374a04b1937aa60a1132c1": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "c016fe5bd4284aaea0322b2282c771f4": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_d0ecbc2e5d9a484e8315f4670ff8b91b", + "placeholder": "​", + "style": "IPY_MODEL_dbccc70ab8ac4369901f29901bdba53c", + "tabbable": null, + "tooltip": null, + "value": " 265/265 [00:00<00:00, 31.7kB/s]" + } + }, + "c08f735baec84172bd6848cb6432ff87": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "c0a5d35dad0e44fd81df4ce88ac32b9e": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "c0cb85d241934573ac8605a8f2601fa2": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_7766cdc6d8c044519c2d779620b21246", + "IPY_MODEL_3d14ac7f692644eb89454650dd2dae1f", + "IPY_MODEL_a88df84670244523baaf6669c9adf949" + ], + "layout": "IPY_MODEL_59294633289c4df8b81887e1d8cda00b", + "tabbable": null, + "tooltip": null + } + }, + "c1102dd1228c479091345ed81be516c7": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "c1c9d87d48d24e74a7314dd5916b1c40": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "c235a89aaf2e4a1fa7f8a9b9251866e5": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "c3585be81d2d480d912aa26d5e1815e3": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "c3f9b0c015634294a76455c9ebf5b48f": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "c4099e61027148ffa4f66a13cab7bdec": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "c4cf5800803b47b384fa0935dc83481a": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "c87fb6446189421aa805ac3999f72c19": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "c8ab9148400f4b648bb74b12ae3d0863": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_7abe4e7f59014837b4dae82ba423cb38", + "IPY_MODEL_777913145e8142f4b9b6173a1595b367", + "IPY_MODEL_d82443061e4841e9b52483a79d5ad990" + ], + "layout": "IPY_MODEL_2c981621578343b0834b8890c8f9ac00", + "tabbable": null, + "tooltip": null + } + }, + "ca29a375b504402089fec49a92dd344e": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_4b6bc0b5e99f434580ae27b78e49a451", + "max": 5547254632, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_d5ed93eb60bf417f922268d3e99439d0", + "tabbable": null, + "tooltip": null, + "value": 5547254632 + } + }, + "caaa672e7f0e41c689e2aedc61a91e90": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "cbfb1c98b9024eea8f0189a406549086": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "ccd6de9aac1a4b269e25a9219cdda807": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "cd759a87594141cb940102df74dcf3ce": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "ce6d1ee6cf81425cb7b6951ce530d34e": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_f51f28d7fec44ae5b2479bc2d42d318a", + "placeholder": "​", + "style": "IPY_MODEL_d0340635e32548d3bf267d099f44e8db", + "tabbable": null, + "tooltip": null, + "value": " 339/339 [00:01<00:00, 147.24it/s]" + } + }, + "ced9eb5361ea4544a3353e6795ab4748": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "cfc6bec735494c868d28e2a8ff0c6358": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_16ec5ecef4644209b32a044c633e8a52", + "placeholder": "​", + "style": "IPY_MODEL_9d592b79075d432b905fa462dd4e1d16", + "tabbable": null, + "tooltip": null, + "value": "special_tokens_map.json: 100%" + } + }, + "d0340635e32548d3bf267d099f44e8db": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "d08c32b2cbfb49c2bdbcb4f96be1c061": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "d0ecbc2e5d9a484e8315f4670ff8b91b": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "d127679ed10a46f6ac817e6ea29ddefb": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "d16551a17dbf4e5ab902b07b56e1c8f9": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "d1c30b448a094da084681f96ecc78e26": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "d579251d80f44cc5bc333217850057a1": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "d5ed93eb60bf417f922268d3e99439d0": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "d63ecee969ab462590aa00a8c963c4d1": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "d82443061e4841e9b52483a79d5ad990": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_553ca1b5d8444ba9bbda273c5f0b2921", + "placeholder": "​", + "style": "IPY_MODEL_4f2f58a661a54c13b2d7e2eb3d56594c", + "tabbable": null, + "tooltip": null, + "value": " 4.98k/? [00:00<00:00, 512kB/s]" + } + }, + "d89d0facd4d54f1098f0013627ca641e": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "dbccc70ab8ac4369901f29901bdba53c": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "dd60190c540b41e49c6ef6514861a7eb": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_ec5e36dcdae04b4ab0b25088552baa59", + "placeholder": "​", + "style": "IPY_MODEL_a4ce863c40f7451db3f5f6ba9090e922", + "tabbable": null, + "tooltip": null, + "value": "README.md: " + } + }, + "dfc2c324d7fd4d51bda2b790102adbb9": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "e02eef7123004f49a3833585ca8e7d63": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "e04315fd081b4689864a012172937449": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_a823cf08126d4bda9e86808b8c2674b0", + "IPY_MODEL_2d6682f461014dc292303a40c99d4dfe", + "IPY_MODEL_976a9680bef541feae2f802b72b9df32" + ], + "layout": "IPY_MODEL_72d0d3225d0d487a97285bdabf0d4bbe", + "tabbable": null, + "tooltip": null + } + }, + "e1498785d0974658a4362fda3065c4d7": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "e159c6c46cab4593b037abb0208bdb8f": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_4626f5b148024aac881ed03a0f5255aa", + "IPY_MODEL_15b2831a8acf44478a0d3dbeb44b93ab", + "IPY_MODEL_1e96c6e2c93a42959619c7ca399c8a93" + ], + "layout": "IPY_MODEL_cd759a87594141cb940102df74dcf3ce", + "tabbable": null, + "tooltip": null + } + }, + "e2e7d7d999d34bdba7c4c154566206d4": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "e55cc58325bb4eefa954c794823f84a6": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": "20px" + } + }, + "e74824de4ae148a9a5cce7456de61ce6": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_c0a5d35dad0e44fd81df4ce88ac32b9e", + "placeholder": "​", + "style": "IPY_MODEL_d1c30b448a094da084681f96ecc78e26", + "tabbable": null, + "tooltip": null, + "value": "config.json: " + } + }, + "e84163c9f9f7423f9699ee3128175a6f": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_a6c1a416f2b241ffb5c2b77e881b1e2d", + "placeholder": "​", + "style": "IPY_MODEL_d579251d80f44cc5bc333217850057a1", + "tabbable": null, + "tooltip": null, + "value": "generation_config.json: 100%" + } + }, + "e98d1746d8e44705be02681f1dec42ad": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_9899e30615e5433ab1d0f237e338cab5", + "IPY_MODEL_45040783dd4c45c98f948ced425e85c7", + "IPY_MODEL_89e769e82c0643f19a723b635ee05fde" + ], + "layout": "IPY_MODEL_e2e7d7d999d34bdba7c4c154566206d4", + "tabbable": null, + "tooltip": null + } + }, + "e98ff8ff16ed4e8ea728ed6dcf8e466e": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "e9dbe58a0604481ca41927407d5b85b6": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_e98ff8ff16ed4e8ea728ed6dcf8e466e", + "placeholder": "​", + "style": "IPY_MODEL_91b15acc4b8743adb5970061f623ece3", + "tabbable": null, + "tooltip": null, + "value": "Generating test split: 100%" + } + }, + "ea1911017af1498782ab1809a9ebfadb": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_4492af2ef3644d9f92ee65620ef5e44b", + "max": 1, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_0e517ea9eb5c48c2aa457389650f77e8", + "tabbable": null, + "tooltip": null, + "value": 1 + } + }, + "ea5bb7d0a2e74221bbc4627997e20025": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "ec26fe9dbf934a05abc4a1f1ce374f99": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_a1a4cb2dbd864813b3f081133f340ee7", + "placeholder": "​", + "style": "IPY_MODEL_462c6bdffc6849f39ac26fb783f9f48d", + "tabbable": null, + "tooltip": null, + "value": "tokenizer_config.json: " + } + }, + "ec5e36dcdae04b4ab0b25088552baa59": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "ee45bf2d57a24250ba88e2edb060b41b": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "background": null, + "description_width": "", + "font_size": null, + "text_color": null + } + }, + "ef02190a0da544a5bf6b94ea3b084f2e": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HTMLView", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_d08c32b2cbfb49c2bdbcb4f96be1c061", + "placeholder": "​", + "style": "IPY_MODEL_7234b29a3a1e421eb593d3c2521f3363", + "tabbable": null, + "tooltip": null, + "value": " 1/1 [00:00<00:00, 143.95it/s]" + } + }, + "ef232c2eadeb45f69a35cd6fecbf6ccd": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "f36cf5b205e441c0969d160090763cf9": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_35eb03e850d54545a42375819dcf3905", + "max": 83920, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_0c2d83738cfb44829888a8bcc84274a4", + "tabbable": null, + "tooltip": null, + "value": 83920 + } + }, + "f4b38320a9ef4e8cacecd17d926d5f27": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_cfc6bec735494c868d28e2a8ff0c6358", + "IPY_MODEL_2fcb73ac60d24fe4a15ac03cf8e5ace1", + "IPY_MODEL_2353243d97be4dd8b54c34c8d83e59b3" + ], + "layout": "IPY_MODEL_e1498785d0974658a4362fda3065c4d7", + "tabbable": null, + "tooltip": null + } + }, + "f51f28d7fec44ae5b2479bc2d42d318a": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "f9fad5e5b63f45819bf724bb47d4845e": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "2.0.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border_bottom": null, + "border_left": null, + "border_right": null, + "border_top": 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, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "ff2f7e13305e40e5899988f584357d59": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "2.0.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "ff6ccc01482f46bdb8310d96230067b4": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "2.0.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "2.0.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "2.0.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_allow_html": false, + "layout": "IPY_MODEL_6b9c83c1a4e24bb2a22e019b6889bfdc", + "max": 1371, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_a91876d8ff66499fa1f37945a20eeaf1", + "tabbable": null, + "tooltip": null, + "value": 1371 + } + } + }, + "version_major": 2, + "version_minor": 0 + } + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/benchmark_evaluation.ipynb b/benchmark_evaluation.ipynb new file mode 100644 index 0000000..6d52a12 --- /dev/null +++ b/benchmark_evaluation.ipynb @@ -0,0 +1,519 @@ +{ + "metadata": { + "kernelspec": { + "language": "python", + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.12.13", + "mimetype": "text/x-python", + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "pygments_lexer": "ipython3", + "nbconvert_exporter": "python", + "file_extension": ".py" + }, + "kaggle": { + "accelerator": "nvidiaTeslaT4", + "dataSources": [], + "isInternetEnabled": true, + "language": "python", + "sourceType": "notebook", + "isGpuEnabled": false + } + }, + "nbformat_minor": 4, + "nbformat": 4, + "cells": [ + { + "cell_type": "code", + "source": "# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session\n\n# Use the kagglehub client library to attach Kaggle resources like competitions, datasets, and models to your session\n# Learn more about kagglehub: https://github.com/Kaggle/kagglehub/blob/main/README.md\n\nimport kagglehub\n# kagglehub.dataset_download('/')", + "metadata": { + "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", + "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "!pip uninstall -y torchao -q\n!pip install -q transformers accelerate datasets evalplus sentencepiece\nprint(\"Done\")", + "metadata": { + "trusted": true, + "execution": { + "iopub.status.busy": "2026-07-16T18:34:10.22367Z", + "iopub.execute_input": "2026-07-16T18:34:10.223899Z", + "iopub.status.idle": "2026-07-16T18:34:27.408138Z", + "shell.execute_reply.started": "2026-07-16T18:34:10.223877Z", + "shell.execute_reply": "2026-07-16T18:34:27.407041Z" + } + }, + "outputs": [ + { + "name": "stdout", + "text": " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n\u001b[2K \u001b[90m\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u001b[0m \u001b[32m68.6/68.6 kB\u001b[0m \u001b[31m1.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n\u001b[2K \u001b[90m\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u001b[0m \u001b[32m956.9/956.9 kB\u001b[0m \u001b[31m12.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n\u001b[2K \u001b[90m\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u001b[0m \u001b[32m115.9/115.9 kB\u001b[0m \u001b[31m6.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[2K \u001b[90m\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u001b[0m \u001b[32m667.5/667.5 kB\u001b[0m \u001b[31m35.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[2K \u001b[90m\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u001b[0m \u001b[32m108.1/108.1 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25h Building wheel for stop-sequencer (setup.py) ... \u001b[?25l\u001b[?25hdone\n Building wheel for tempdir (setup.py) ... \u001b[?25l\u001b[?25hdone\n Building wheel for wget (setup.py) ... \u001b[?25l\u001b[?25hdone\nDone\n", + "output_type": "stream" + } + ], + "execution_count": 1 + }, + { + "cell_type": "code", + "source": "import os, gc, json, sys, subprocess, tempfile, time, traceback, warnings\nfrom datetime import datetime, timezone\nfrom typing import Any, Dict, List, Optional\nfrom collections import OrderedDict\nwarnings.filterwarnings(\"ignore\")\n\nimport torch\nos.environ[\"TOKENIZERS_PARALLELISM\"] = \"false\"\nos.environ[\"PYTORCH_CUDA_ALLOC_CONF\"] = \"expandable_segments:True\"\n\nfrom kaggle_secrets import UserSecretsClient\nos.environ[\"HF_TOKEN\"] = UserSecretsClient().get_secret(\"HF_TOKEN\")\n\nfrom huggingface_hub import login\nlogin(token=os.environ[\"HF_TOKEN\"])\n\nfor i in range(torch.cuda.device_count()):\n p = torch.cuda.get_device_properties(i)\n print(f\"GPU {i}: {p.name} ({p.total_memory/1e9:.1f} GB)\")", + "metadata": { + "trusted": true, + "execution": { + "iopub.status.busy": "2026-07-16T18:34:51.597293Z", + "iopub.execute_input": "2026-07-16T18:34:51.598206Z", + "iopub.status.idle": "2026-07-16T18:34:53.274328Z", + "shell.execute_reply.started": "2026-07-16T18:34:51.598169Z", + "shell.execute_reply": "2026-07-16T18:34:53.273346Z" + } + }, + "outputs": [ + { + "name": "stderr", + "text": "Note: Environment variable`HF_TOKEN` is set and is the current active token independently from the token you've just configured.\n", + "output_type": "stream" + }, + { + "name": "stdout", + "text": "GPU 0: Tesla T4 (15.6 GB)\nGPU 1: Tesla T4 (15.6 GB)\n", + "output_type": "stream" + } + ], + "execution_count": 3 + }, + { + "cell_type": "code", + "source": "MODEL_ID = \"sandeeprdy1729/TIMPS-Coder-7B\"\nOUTPUT_DIR = \"/kaggle/working/timps-benchmarks\"\nos.makedirs(OUTPUT_DIR, exist_ok=True)\n\nMAX_NEW_TOKENS = 512\nTEMPERATURE = 0.1\nTOP_P = 0.95\n\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nprint(f\"Loading {MODEL_ID} ...\")\nt0 = time.time()\ndtype = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16\nmodel = AutoModelForCausalLM.from_pretrained(\n MODEL_ID, torch_dtype=dtype, device_map=\"auto\", trust_remote_code=True,\n)\ntokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\nif tokenizer.pad_token is None:\n tokenizer.pad_token = tokenizer.eos_token\nmodel.eval()\nprint(f\"Loaded in {time.time()-t0:.1f}s | VRAM: {torch.cuda.memory_allocated()/1e9:.2f} GB\")", + "metadata": { + "trusted": true, + "execution": { + "iopub.status.busy": "2026-07-16T18:35:00.552166Z", + "iopub.execute_input": "2026-07-16T18:35:00.552989Z", + "iopub.status.idle": "2026-07-16T18:37:05.693429Z", + "shell.execute_reply.started": "2026-07-16T18:35:00.552957Z", + "shell.execute_reply": "2026-07-16T18:37:05.692577Z" + } + }, + "outputs": [ + { + "name": "stdout", + "text": "Loading sandeeprdy1729/TIMPS-Coder-7B ...\n", + "output_type": "stream" + }, + { + "output_type": "display_data", + "data": { + "text/plain": "config.json: 0.00B [00:00, ?B/s]", + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "8b01012f34244751800d730837b69bbc" + } + }, + "metadata": {} + }, + { + "name": "stderr", + "text": "`torch_dtype` is deprecated! Use `dtype` instead!\n", + "output_type": "stream" + }, + { + "output_type": "display_data", + "data": { + "text/plain": "model.safetensors.index.json: 0.00B [00:00, ?B/s]", + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "3cb7862321904ca1a3bdd5a505f9df38" + } + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": "Downloading (incomplete total...): 0.00B [00:00, ?B/s]", + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "e02ebb8474854f1389f711f429ac0346" + } + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": "Fetching 4 files: 0%| | 0/4 [00:00 str:\n text = generation.strip()\n if \"```python\" in text:\n parts = text.split(\"```python\")\n if len(parts) > 1:\n return parts[1].split(\"```\")[0].strip()\n if \"```\" in text:\n parts = text.split(\"```\")\n for part in parts[1:]:\n code = part.strip()\n first = code.split(\"\\n\")[0].strip()\n if first and not first.startswith((\"def \", \"class \", \"import \", \"from \")):\n code = \"\\n\".join(code.split(\"\\n\")[1:]).strip()\n if code:\n return code\n lines = text.split(\"\\n\")\n code_lines, started = [], False\n for line in lines:\n s = line.strip()\n if s.startswith((\"def \", \"class \", \"import \", \"from \")):\n started = True\n if started:\n code_lines.append(line)\n return \"\\n\".join(code_lines).strip() if code_lines else text\n\n\ndef run_test(code: str, test_code: str, timeout: float = 10.0) -> Dict[str, Any]:\n full = code + \"\\n\\n\" + test_code + \"\\n\\nprint('TEST_PASSED')\\n\"\n tmp = None\n try:\n with tempfile.NamedTemporaryFile(mode=\"w\", suffix=\".py\", delete=False) as f:\n f.write(full); tmp = f.name\n proc = subprocess.run(\n [sys.executable, tmp], capture_output=True, text=True, timeout=timeout,\n env={**os.environ, \"PYTHONDONTWRITEBYTECODE\": \"1\"},\n )\n passed = \"TEST_PASSED\" in proc.stdout\n return {\"passed\": passed, \"error\": None if passed else (proc.stderr[-300:] or \"tests did not pass\")}\n except subprocess.TimeoutExpired:\n return {\"passed\": False, \"error\": \"timeout\"}\n except Exception as e:\n return {\"passed\": False, \"error\": str(e)[:200]}\n finally:\n if tmp:\n try: os.unlink(tmp)\n except OSError: pass\n\n\ndef generate_one(prompt: str) -> str:\n if hasattr(tokenizer, \"apply_chat_template\"):\n messages = [\n {\"role\": \"system\", \"content\": \"You are an expert Python programmer. Write a complete, correct, and efficient solution. Output ONLY the code, no explanation.\"},\n {\"role\": \"user\", \"content\": prompt},\n ]\n try:\n chat = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n except Exception:\n chat = f\"<|im_start|>system\\nYou are an expert Python programmer. Write a complete, correct, and efficient solution. Output ONLY the code, no explanation.<|im_end|>\\n<|im_start|>user\\n{prompt}<|im_end|>\\n<|im_start|>assistant\\n\"\n else:\n chat = f\"<|im_start|>system\\nYou are an expert Python programmer. Write a complete, correct, and efficient solution. Output ONLY the code, no explanation.<|im_end|>\\n<|im_start|>user\\n{prompt}<|im_end|>\\n<|im_start|>assistant\\n\"\n\n inputs = tokenizer(chat, return_tensors=\"pt\", truncation=True, max_length=1536)\n inputs = {k: v.to(model.device) for k, v in inputs.items()}\n with torch.no_grad():\n out = model.generate(\n **inputs, max_new_tokens=MAX_NEW_TOKENS, temperature=TEMPERATURE,\n top_p=TOP_P, do_sample=(TEMPERATURE > 0),\n pad_token_id=tokenizer.pad_token_id, eos_token_id=tokenizer.eos_token_id,\n )\n new_tokens = out[0][inputs[\"input_ids\"].shape[1]:]\n return tokenizer.decode(new_tokens, skip_special_tokens=True)", + "metadata": { + "trusted": true, + "execution": { + "iopub.status.busy": "2026-07-16T18:37:33.497179Z", + "iopub.execute_input": "2026-07-16T18:37:33.497638Z", + "iopub.status.idle": "2026-07-16T18:37:33.51044Z", + "shell.execute_reply.started": "2026-07-16T18:37:33.497608Z", + "shell.execute_reply": "2026-07-16T18:37:33.509737Z" + } + }, + "outputs": [], + "execution_count": 9 + }, + { + "cell_type": "code", + "source": [ + "from datasets import load_dataset\n", + "\n", + "print(\"=\" * 60)\n", + "print(\" BENCHMARK: HumanEval (164 problems)\")\n", + "print(\"=\" * 60)\n", + "\n", + "ds = load_dataset(\"openai/openai_humaneval\", split=\"test\")\n", + "problems = list(ds)\n", + "total = len(problems)\n", + "passed = failed = errors = 0\n", + "he_details = []\n", + "\n", + "t0 = time.time()\n", + "for i, prob in enumerate(problems):\n", + " prompt, test, entry_point = prob[\"prompt\"], prob[\"test\"], prob[\"entry_point\"]\n", + " try:\n", + " gen = generate_one(prompt)\n", + " code = extract_code(gen)\n", + " res = run_test(code, test)\n", + " ok = res[\"passed\"]\n", + " except Exception as e:\n", + " ok, res, code = False, {\"passed\": False, \"error\": str(e)[:200]}, \"\"\n", + "\n", + " if ok: passed += 1; tag = \"PASS\"\n", + " elif res.get(\"error\") and (\"Error\" in str(res[\"error\"]) or \"timeout\" in str(res.get(\"error\",\"\")).lower()):\n", + " errors += 1; tag = \"ERR\"\n", + " else: failed += 1; tag = \"FAIL\"\n", + "\n", + " # NOTE: we now store the generated `code` so HumanEval+ can reuse it\n", + " # instead of re-running generation for all 164 problems a second time.\n", + " he_details.append({\"idx\": i, \"task_id\": prob[\"task_id\"], \"entry_point\": entry_point,\n", + " \"passed\": ok, \"tag\": tag, \"error\": res.get(\"error\"), \"code\": code})\n", + " if (i + 1) % 10 == 0 or i == total - 1:\n", + " print(f\" [{i+1:>3}/{total}] {tag:<5} running pass@1 = {passed/(i+1)*100:.1f}%\")\n", + "\n", + "he_result = {\"benchmark\": \"HumanEval\", \"total\": total, \"passed\": passed, \"failed\": failed,\n", + " \"errors\": errors, \"pass@1\": round(passed/total*100, 1), \"per_problem\": he_details}\n", + "print(f\"\\n HumanEval done in {(time.time()-t0)/60:.1f} min | pass@1 = {he_result['pass@1']}%\")" + ], + "metadata": { + "trusted": true, + "execution": { + "iopub.status.busy": "2026-07-16T18:37:38.550056Z", + "iopub.execute_input": "2026-07-16T18:37:38.551101Z", + "execution_failed": "2026-07-16T18:44:48.67Z" + } + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": [ + "print(\"=\" * 60)\n", + "print(\" BENCHMARK: HumanEval+ (extended tests via evalplus)\")\n", + "print(\"=\" * 60)\n", + "\n", + "from evalplus.data import get_human_eval_plus\n", + "from evalplus.eval import PASS\n", + "\n", + "t0 = time.time()\n", + "hep_result = None\n", + "\n", + "try:\n", + " hep_problems = get_human_eval_plus() # same 164 problems, with extra \"plus\" tests\n", + "\n", + " # Reuse the code already generated during the HumanEval pass above \u2014\n", + " # no need to regenerate (this alone halves the GPU time this cell used to burn).\n", + " samples_path = f\"{OUTPUT_DIR}/humaneval_plus_samples.jsonl\"\n", + " result_path = samples_path.replace(\".jsonl\", \"_eval_results.json\")\n", + " for p in (samples_path, result_path):\n", + " if os.path.exists(p):\n", + " os.remove(p) # evalplus prompts interactively if a stale result file exists\n", + "\n", + " covered = set()\n", + " with open(samples_path, \"w\") as f:\n", + " for d in he_details:\n", + " task_id = d[\"task_id\"]\n", + " if task_id in hep_problems and d[\"code\"]:\n", + " f.write(json.dumps({\"task_id\": task_id, \"solution\": d[\"code\"]}) + \"\\n\")\n", + " covered.add(task_id)\n", + "\n", + " missing = set(hep_problems) - covered\n", + " if missing:\n", + " print(f\" Filling {len(missing)} problem(s) missing/empty from the base run ...\")\n", + " with open(samples_path, \"a\") as f:\n", + " for task_id in missing:\n", + " try:\n", + " gen = generate_one(hep_problems[task_id][\"prompt\"])\n", + " code = extract_code(gen)\n", + " except Exception:\n", + " code = \"\"\n", + " f.write(json.dumps({\"task_id\": task_id, \"solution\": code}) + \"\\n\")\n", + "\n", + " from evalplus.evaluate import evaluate as ev_eval\n", + " ev_eval(dataset=\"humaneval\", samples=samples_path, i_just_wanna_run=True)\n", + "\n", + " with open(result_path) as f:\n", + " raw = json.load(f)\n", + " n = len(raw[\"eval\"])\n", + " base_pass = sum(1 for r in raw[\"eval\"].values() if r[0][\"base_status\"] == PASS)\n", + " plus_pass = sum(1 for r in raw[\"eval\"].values()\n", + " if r[0][\"base_status\"] == PASS and r[0][\"plus_status\"] == PASS)\n", + " hep_result = {\n", + " \"benchmark\": \"HumanEval+\", \"total\": n, \"passed\": plus_pass,\n", + " \"pass@1\": round(plus_pass / n * 100, 1),\n", + " \"base_pass@1\": round(base_pass / n * 100, 1),\n", + " \"evalplus_raw_path\": result_path,\n", + " }\n", + " print(f\" HumanEval+ pass@1 = {hep_result['pass@1']}% (base-only pass@1 = {hep_result['base_pass@1']}%)\")\n", + "\n", + "except Exception as e:\n", + " print(f\"[humaneval+] evalplus failed: {e}\")\n", + " traceback.print_exc()\n", + " passed = sum(1 for d in he_details if d[\"passed\"])\n", + " hep_result = {\"benchmark\": \"HumanEval+\", \"total\": len(he_details), \"passed\": passed,\n", + " \"pass@1\": round(passed/len(he_details)*100, 1), \"note\": f\"evalplus error: {e}\",\n", + " \"per_problem\": he_details}\n", + "\n", + "print(f\" Done in {(time.time()-t0)/60:.1f} min\")" + ], + "metadata": { + "trusted": true, + "execution": { + "execution_failed": "2026-07-16T18:44:48.67Z" + } + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": [ + "print(\"=\" * 60)\n", + "print(\" BENCHMARK: MBPP (974 problems)\")\n", + "print(\"=\" * 60)\n", + "\n", + "ds_mbpp = load_dataset(\"google-research-datasets/mbpp\", split=\"test\")\n", + "mbpp_problems = list(ds_mbpp)\n", + "total = len(mbpp_problems)\n", + "passed = failed = errors = 0\n", + "mbpp_details = []\n", + "\n", + "t0 = time.time()\n", + "for i, prob in enumerate(mbpp_problems):\n", + " # BUG FIX: this dataset's field is \"text\", not \"prompt\" (that key doesn't exist\n", + " # and was throwing KeyError: 'prompt' before generating a single sample).\n", + " prompt = prob.get(\"text\", prob.get(\"prompt\", \"\"))\n", + " test_list = prob.get(\"test_list\", [])\n", + " test_code = \"\\n\".join(test_list) if test_list else \"\"\n", + " try:\n", + " gen = generate_one(prompt)\n", + " code = extract_code(gen)\n", + " res = run_test(code, test_code)\n", + " ok = res[\"passed\"]\n", + " except Exception as e:\n", + " ok, res, code = False, {\"passed\": False, \"error\": str(e)[:200]}, \"\"\n", + "\n", + " if ok: passed += 1; tag = \"PASS\"\n", + " elif res.get(\"error\") and (\"Error\" in str(res[\"error\"]) or \"timeout\" in str(res.get(\"error\",\"\")).lower()):\n", + " errors += 1; tag = \"ERR\"\n", + " else: failed += 1; tag = \"FAIL\"\n", + "\n", + " mbpp_details.append({\"idx\": i, \"task_id\": prob.get(\"task_id\", f\"mbpp_{i}\"),\n", + " \"passed\": ok, \"tag\": tag, \"error\": res.get(\"error\"), \"code\": code})\n", + " if (i + 1) % 50 == 0 or i == total - 1:\n", + " print(f\" [{i+1:>3}/{total}] {tag:<5} running pass@1 = {passed/(i+1)*100:.1f}%\")\n", + "\n", + "mbpp_result = {\"benchmark\": \"MBPP\", \"total\": total, \"passed\": passed, \"failed\": failed,\n", + " \"errors\": errors, \"pass@1\": round(passed/total*100, 1), \"per_problem\": mbpp_details}\n", + "print(f\"\\n MBPP done in {(time.time()-t0)/60:.1f} min | pass@1 = {mbpp_result['pass@1']}%\")" + ], + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": [ + "print(\"=\" * 60)\n", + "print(\" BENCHMARK: MBPP+ (extended tests via evalplus)\")\n", + "print(\"=\" * 60)\n", + "\n", + "from evalplus.data import get_mbpp_plus\n", + "from evalplus.eval import PASS\n", + "\n", + "t0 = time.time()\n", + "mbppp_result = None\n", + "\n", + "try:\n", + " # NOTE: evalplus's MBPP+ is a separate, sanitized ~399-problem subset with its\n", + " # own task_ids and prompts \u2014 it does NOT line up 1:1 with the raw 974-problem\n", + " # MBPP test split used in the cell above, so we can't reuse those completions.\n", + " # We generate fresh (but only for this smaller set, not all 974 again).\n", + " mbppp_problems = get_mbpp_plus()\n", + " mbppp_task_ids = list(mbppp_problems.keys())\n", + " n_tasks = len(mbppp_task_ids)\n", + " print(f\" evalplus MBPP+ has {n_tasks} sanitized problems (independent of the raw MBPP split above)\")\n", + "\n", + " samples_path = f\"{OUTPUT_DIR}/mbpp_plus_samples.jsonl\"\n", + " result_path = samples_path.replace(\".jsonl\", \"_eval_results.json\")\n", + " for p in (samples_path, result_path):\n", + " if os.path.exists(p):\n", + " os.remove(p)\n", + "\n", + " with open(samples_path, \"w\") as f:\n", + " for i, task_id in enumerate(mbppp_task_ids):\n", + " prompt = mbppp_problems[task_id][\"prompt\"]\n", + " try:\n", + " gen = generate_one(prompt)\n", + " code = extract_code(gen)\n", + " except Exception:\n", + " code = \"\"\n", + " f.write(json.dumps({\"task_id\": task_id, \"solution\": code}) + \"\\n\")\n", + " if (i + 1) % 50 == 0 or i == n_tasks - 1:\n", + " print(f\" Generated {i+1}/{n_tasks} solutions ...\")\n", + "\n", + " from evalplus.evaluate import evaluate as ev_eval\n", + " ev_eval(dataset=\"mbpp\", samples=samples_path, i_just_wanna_run=True)\n", + "\n", + " with open(result_path) as f:\n", + " raw = json.load(f)\n", + " n = len(raw[\"eval\"])\n", + " base_pass = sum(1 for r in raw[\"eval\"].values() if r[0][\"base_status\"] == PASS)\n", + " plus_pass = sum(1 for r in raw[\"eval\"].values()\n", + " if r[0][\"base_status\"] == PASS and r[0][\"plus_status\"] == PASS)\n", + " mbppp_result = {\n", + " \"benchmark\": \"MBPP+\", \"total\": n, \"passed\": plus_pass,\n", + " \"pass@1\": round(plus_pass / n * 100, 1),\n", + " \"base_pass@1\": round(base_pass / n * 100, 1),\n", + " \"evalplus_raw_path\": result_path,\n", + " }\n", + " print(f\" MBPP+ pass@1 = {mbppp_result['pass@1']}% (base-only pass@1 = {mbppp_result['base_pass@1']}%)\")\n", + "\n", + "except Exception as e:\n", + " print(f\"[mbpp+] evalplus failed: {e}\")\n", + " traceback.print_exc()\n", + " mbppp_result = {**mbpp_result, \"benchmark\": \"MBPP+\", \"note\": f\"evalplus error: {e}\"}\n", + "\n", + "print(f\" Done in {(time.time()-t0)/60:.1f} min\")" + ], + "metadata": { + "trusted": true, + "execution": { + "execution_failed": "2026-07-16T18:44:48.67Z" + } + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "BASELINES = {\n \"Model\": [\"TIMPS-Coder-7B (this model)\", \"Qwen2.5-Coder-7B-Instruct\", \"Qwen2.5-Coder-7B\",\n \"DeepSeek-Coder-7B-Instruct-v1.5\", \"CodeLlama-7B-Instruct\", \"CodeGemma-7B-it\",\n \"StarCoder2-7B\", \"Llama-3.1-8B-Instruct\", \"Phi-3.5-mini-instruct (3.8B)\", \"Gemma-2-9B-it\"],\n \"HumanEval\": [\"\u2014\", \"86.6\", \"89.6\", \"84.1\", \"53.7\", \"56.1\", \"40.2\", \"72.6\", \"68.8\", \"54.3\"],\n \"HumanEval+\": [\"\u2014\", \"71.3\", \"76.2\", \"70.8\", \"44.5\", \"46.9\", \"32.9\", \"61.0\", \"57.9\", \"44.5\"],\n \"MBPP\": [\"\u2014\", \"82.0\", \"84.0\", \"79.6\", \"55.6\", \"61.8\", \"46.0\", \"70.8\", \"73.0\", \"59.6\"],\n \"MBPP+\": [\"\u2014\", \"69.6\", \"72.0\", \"68.4\", \"45.0\", \"50.6\", \"36.5\", \"58.7\", \"61.3\", \"49.3\"],\n \"Params\": [\"7B\", \"7.6B\", \"7.6B\", \"7.1B\", \"6.7B\", \"7.0B\", \"7.0B\", \"8.0B\", \"3.8B\", \"9.2B\"],\n}\n\nresults = {\"humaneval\": he_result, \"humaneval_plus\": hep_result, \"mbpp\": mbpp_result, \"mbpp_plus\": mbppp_result}\n\n# Fill in TIMPS-Coder scores\nbl = {k: list(v) for k, v in BASELINES.items()}\nbl[\"HumanEval\"][0] = str(he_result.get(\"pass@1\", \"\u2014\"))\nbl[\"HumanEval+\"][0] = str(hep_result.get(\"pass@1\", \"\u2014\"))\nbl[\"MBPP\"][0] = str(mbpp_result.get(\"pass@1\", \"\u2014\"))\nbl[\"MBPP+\"][0] = str(mbppp_result.get(\"pass@1\", \"\u2014\"))\n\ncols = list(bl.keys())\nhdr = \"| \" + \" | \".join(cols) + \" |\"\nsep = \"|\" + \"|\".join([\"---\"] * len(cols)) + \"|\"\nrows = [\"| \" + \" | \".join(str(bl[c][i]) for c in cols) + \" |\" for i in range(len(bl[\"Model\"]))]\ntable = \"\\n\".join([hdr, sep] + rows)\n\nprint(table)\n\n# Save results\npayload = {\n \"model\": MODEL_ID, \"timestamp\": datetime.now(timezone.utc).isoformat(),\n \"results_summary\": {name: {\"pass@1\": r.get(\"pass@1\"), \"total\": r.get(\"total\"), \"passed\": r.get(\"passed\")} for name, r in results.items()},\n \"detailed_results\": results,\n}\nwith open(f\"{OUTPUT_DIR}/benchmark_results.json\", \"w\") as f:\n json.dump(payload, f, indent=2, default=str)\nprint(f\"\\nResults saved to {OUTPUT_DIR}/benchmark_results.json\")", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "he = he_result.get(\"pass@1\", \"\u2014\")\nhep = hep_result.get(\"pass@1\", \"\u2014\")\nmb = mbpp_result.get(\"pass@1\", \"\u2014\")\nmbp = mbppp_result.get(\"pass@1\", \"\u2014\")\n\nMODEL_CARD = f\"\"\"---\nlicense: apache-2.0\nlanguage: [en]\nbase_model: Qwen/Qwen2.5-Coder-7B-Instruct\ntags: [code, qwen2.5, lora, merged, sft, dpo, grpo]\nlibrary_name: transformers\npipeline_tag: text-generation\nmodel-index:\n- name: TIMPS-Coder-7B\n results:\n - task: {{\"type\": \"text-generation\", \"name\": \"Code Generation\"}}\n dataset: {{\"type\": \"openai_humaneval\", \"name\": \"HumanEval\"}}\n metrics:\n - {{type: \"pass@1\", \"value\": {he}, \"name\": \"pass@1\"}}\n - task: {{\"type\": \"text-generation\", \"name\": \"Code Generation\"}}\n dataset: {{\"type\": \"evalplus/humanevalplus\", \"name\": \"HumanEval+\"}}\n metrics:\n - {{type: \"pass@1\", \"value\": {hep}, \"name\": \"pass@1\"}}\n - task: {{\"type\": \"text-generation\", \"name\": \"Code Generation\"}}\n dataset: {{\"type\": \"mbpp\", \"name\": \"MBPP\"}}\n metrics:\n - {{type: \"pass@1\", \"value\": {mb}, \"name\": \"pass@1\"}}\n - task: {{\"type\": \"text-generation\", \"name\": \"Code Generation\"}}\n dataset: {{\"type\": \"evalplus/mbppplus\", \"name\": \"MBPP+\"}}\n metrics:\n - {{type: \"pass@1\", \"value\": {mbp}, \"name\": \"pass@1\"}}\n---\n\n# TIMPS-Coder-7B\n\nTIMPS-Coder-7B is a code-generation model built by fine-tuning **Qwen2.5-Coder-7B-Instruct**\nthrough a 4-step pipeline: SFT, GRPO, DPO, and Self-Guided Self-Play.\n\n## Benchmark Results\n\n| Benchmark | Score |\n|-----------|-------|\n| **HumanEval pass@1** | **{he}%** |\n| **HumanEval+ pass@1** | **{hep}%** |\n| **MBPP pass@1** | **{mb}%** |\n| **MBPP+ pass@1** | **{mbp}%** |\n\n### Comparison with 7B-9B Code Models\n\n{table}\n\n## Usage\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\nmodel = AutoModelForCausalLM.from_pretrained(\"sandeeprdy1729/TIMPS-Coder-7B\", device_map=\"auto\", torch_dtype=\"auto\")\ntokenizer = AutoTokenizer.from_pretrained(\"sandeeprdy1729/TIMPS-Coder-7B\")\nmessages = [{{\"role\": \"user\", \"content\": \"Write a fibonacci function.\"}}]\ninputs = tokenizer.apply_chat_template(messages, return_tensors=\"pt\").to(model.device)\nprint(tokenizer.decode(model.generate(inputs, max_new_tokens=512)[0]))\n\"\"\"\n\nwith open(f\"{OUTPUT_DIR}/model_card_results.md\", \"w\") as f:\n f.write(MODEL_CARD)\nprint(f\"Model card saved to {OUTPUT_DIR}/model_card_results.md\")\nprint(MODEL_CARD)", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + }, + { + "cell_type": "code", + "source": "\n#**Cell 11 \u2014 Push scores to HuggingFace model card (optional):**\n# ```python\nfrom huggingface_hub import HfApi\n\napi = HfApi()\napi.upload_file(\n path_or_fileobj=f\"{OUTPUT_DIR}/model_card_results.md\",\n path_in_repo=\"README.md\",\n repo_id=MODEL_ID,\n repo_type=\"model\",\n commit_message=f\"Add benchmark results: HE={he}% HE+={hep}% MBPP={mb}% MBPP+={mbp}%\",\n)\nprint(f\"Model card updated at https://huggingface.co/{MODEL_ID}\")", + "metadata": { + "trusted": true + }, + "outputs": [], + "execution_count": null + } + ] +} \ No newline at end of file diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..bdf7919 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,54 @@ +{%- if tools %} + {{- '<|im_start|>system\n' }} + {%- if messages[0]['role'] == 'system' %} + {{- messages[0]['content'] }} + {%- else %} + {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }} + {%- endif %} + {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n" }} + {%- for tool in tools %} + {{- "\n" }} + {{- tool | tojson }} + {%- endfor %} + {{- "\n\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{\"name\": , \"arguments\": }\n<|im_end|>\n" }} +{%- else %} + {%- if messages[0]['role'] == 'system' %} + {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }} + {%- else %} + {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }} + {%- endif %} +{%- endif %} +{%- for message in messages %} + {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %} + {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} + {%- elif message.role == "assistant" %} + {{- '<|im_start|>' + message.role }} + {%- if message.content %} + {{- '\n' + message.content }} + {%- endif %} + {%- for tool_call in message.tool_calls %} + {%- if tool_call.function is defined %} + {%- set tool_call = tool_call.function %} + {%- endif %} + {{- '\n\n{"name": "' }} + {{- tool_call.name }} + {{- '", "arguments": ' }} + {{- tool_call.arguments | tojson }} + {{- '}\n' }} + {%- endfor %} + {{- '<|im_end|>\n' }} + {%- elif message.role == "tool" %} + {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} + {{- '<|im_start|>user' }} + {%- endif %} + {{- '\n\n' }} + {{- message.content }} + {{- '\n' }} + {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} + {{- '<|im_end|>\n' }} + {%- endif %} + {%- endif %} +{%- endfor %} +{%- if add_generation_prompt %} + {{- '<|im_start|>assistant\n' }} +{%- endif %} diff --git a/config.json b/config.json new file mode 100644 index 0000000..8111401 --- /dev/null +++ b/config.json @@ -0,0 +1,61 @@ +{ + "architectures": [ + "Qwen2ForCausalLM" + ], + "attention_dropout": 0.0, + "bos_token_id": 151643, + "dtype": "bfloat16", + "eos_token_id": 151645, + "hidden_act": "silu", + "hidden_size": 3584, + "initializer_range": 0.02, + "intermediate_size": 18944, + "layer_types": [ + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention" + ], + "max_position_embeddings": 32768, + "max_window_layers": 28, + "model_type": "qwen2", + "num_attention_heads": 28, + "num_hidden_layers": 28, + "num_key_value_heads": 4, + "pad_token_id": null, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 1000000.0, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": false, + "transformers_version": "5.14.1", + "use_cache": true, + "use_sliding_window": false, + "vocab_size": 152064 +} diff --git a/model-1-of-4.safetensors b/model-1-of-4.safetensors new file mode 100644 index 0000000..db2d792 --- /dev/null +++ b/model-1-of-4.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9138a2393e0f690f5f17b6e1fc88fe90c4066014cd8ee5158dea95b029e0b869 +size 4217008248 diff --git a/model-2-of-4.safetensors b/model-2-of-4.safetensors new file mode 100644 index 0000000..1f09528 --- /dev/null +++ b/model-2-of-4.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a636b7518ff3bcedc4fb69ab159df67cd79cf7d204d623dc85cece8540659e53 +size 4195052584 diff --git a/model-3-of-4.safetensors b/model-3-of-4.safetensors new file mode 100644 index 0000000..1a9fd0f --- /dev/null +++ b/model-3-of-4.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55e15f17566a7e2d97ee8ead4e29a6f855c5cadf544c3a3030a011f677178291 +size 4195052632 diff --git a/model-4-of-4.safetensors b/model-4-of-4.safetensors new file mode 100644 index 0000000..38d8a8f --- /dev/null +++ b/model-4-of-4.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90a8911fe69b9eab6572ab085cd08acf8ce5e7ff045f36a1f854970d00c41625 +size 2624158280 diff --git a/model.safetensors.index.json b/model.safetensors.index.json new file mode 100644 index 0000000..6b0e1e0 --- /dev/null +++ b/model.safetensors.index.json @@ -0,0 +1,346 @@ +{ + "metadata": { + "format": "pt" + }, + "weight_map": { + "model.embed_tokens.weight": "model-1-of-4.safetensors", + "model.layers.0.self_attn.q_proj.weight": "model-1-of-4.safetensors", + "model.layers.0.self_attn.q_proj.bias": "model-1-of-4.safetensors", + "model.layers.0.self_attn.k_proj.weight": "model-1-of-4.safetensors", + "model.layers.0.self_attn.k_proj.bias": "model-1-of-4.safetensors", + "model.layers.0.self_attn.v_proj.weight": "model-1-of-4.safetensors", + "model.layers.0.self_attn.v_proj.bias": "model-1-of-4.safetensors", + "model.layers.0.self_attn.o_proj.weight": "model-1-of-4.safetensors", + "model.layers.0.mlp.gate_proj.weight": "model-1-of-4.safetensors", + "model.layers.0.mlp.up_proj.weight": "model-1-of-4.safetensors", + "model.layers.0.mlp.down_proj.weight": "model-1-of-4.safetensors", + "model.layers.0.input_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.0.post_attention_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.1.self_attn.q_proj.weight": "model-1-of-4.safetensors", + "model.layers.1.self_attn.q_proj.bias": "model-1-of-4.safetensors", + "model.layers.1.self_attn.k_proj.weight": "model-1-of-4.safetensors", + "model.layers.1.self_attn.k_proj.bias": "model-1-of-4.safetensors", + "model.layers.1.self_attn.v_proj.weight": "model-1-of-4.safetensors", + "model.layers.1.self_attn.v_proj.bias": "model-1-of-4.safetensors", + "model.layers.1.self_attn.o_proj.weight": "model-1-of-4.safetensors", + "model.layers.1.mlp.gate_proj.weight": "model-1-of-4.safetensors", + "model.layers.1.mlp.up_proj.weight": "model-1-of-4.safetensors", + "model.layers.1.mlp.down_proj.weight": "model-1-of-4.safetensors", + "model.layers.1.input_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.1.post_attention_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.2.self_attn.q_proj.weight": "model-1-of-4.safetensors", + "model.layers.2.self_attn.q_proj.bias": "model-1-of-4.safetensors", + "model.layers.2.self_attn.k_proj.weight": "model-1-of-4.safetensors", + "model.layers.2.self_attn.k_proj.bias": "model-1-of-4.safetensors", + "model.layers.2.self_attn.v_proj.weight": "model-1-of-4.safetensors", + "model.layers.2.self_attn.v_proj.bias": "model-1-of-4.safetensors", + "model.layers.2.self_attn.o_proj.weight": "model-1-of-4.safetensors", + "model.layers.2.mlp.gate_proj.weight": "model-1-of-4.safetensors", + "model.layers.2.mlp.up_proj.weight": "model-1-of-4.safetensors", + "model.layers.2.mlp.down_proj.weight": "model-1-of-4.safetensors", + "model.layers.2.input_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.2.post_attention_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.3.self_attn.q_proj.weight": "model-1-of-4.safetensors", + "model.layers.3.self_attn.q_proj.bias": "model-1-of-4.safetensors", + "model.layers.3.self_attn.k_proj.weight": "model-1-of-4.safetensors", + "model.layers.3.self_attn.k_proj.bias": "model-1-of-4.safetensors", + "model.layers.3.self_attn.v_proj.weight": "model-1-of-4.safetensors", + "model.layers.3.self_attn.v_proj.bias": "model-1-of-4.safetensors", + "model.layers.3.self_attn.o_proj.weight": "model-1-of-4.safetensors", + "model.layers.3.mlp.gate_proj.weight": "model-1-of-4.safetensors", + "model.layers.3.mlp.up_proj.weight": "model-1-of-4.safetensors", + "model.layers.3.mlp.down_proj.weight": "model-1-of-4.safetensors", + "model.layers.3.input_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.3.post_attention_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.4.self_attn.q_proj.weight": "model-1-of-4.safetensors", + "model.layers.4.self_attn.q_proj.bias": "model-1-of-4.safetensors", + "model.layers.4.self_attn.k_proj.weight": "model-1-of-4.safetensors", + "model.layers.4.self_attn.k_proj.bias": "model-1-of-4.safetensors", + "model.layers.4.self_attn.v_proj.weight": "model-1-of-4.safetensors", + "model.layers.4.self_attn.v_proj.bias": "model-1-of-4.safetensors", + "model.layers.4.self_attn.o_proj.weight": "model-1-of-4.safetensors", + "model.layers.4.mlp.gate_proj.weight": "model-1-of-4.safetensors", + "model.layers.4.mlp.up_proj.weight": "model-1-of-4.safetensors", + "model.layers.4.mlp.down_proj.weight": "model-1-of-4.safetensors", + "model.layers.4.input_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.4.post_attention_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.5.self_attn.q_proj.weight": "model-1-of-4.safetensors", + "model.layers.5.self_attn.q_proj.bias": "model-1-of-4.safetensors", + "model.layers.5.self_attn.k_proj.weight": "model-1-of-4.safetensors", + "model.layers.5.self_attn.k_proj.bias": "model-1-of-4.safetensors", + "model.layers.5.self_attn.v_proj.weight": "model-1-of-4.safetensors", + "model.layers.5.self_attn.v_proj.bias": "model-1-of-4.safetensors", + "model.layers.5.self_attn.o_proj.weight": "model-1-of-4.safetensors", + "model.layers.5.mlp.gate_proj.weight": "model-1-of-4.safetensors", + "model.layers.5.mlp.up_proj.weight": "model-1-of-4.safetensors", + "model.layers.5.mlp.down_proj.weight": "model-1-of-4.safetensors", + "model.layers.5.input_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.5.post_attention_layernorm.weight": "model-1-of-4.safetensors", + "model.layers.6.self_attn.q_proj.weight": "model-1-of-4.safetensors", + "model.layers.6.self_attn.q_proj.bias": "model-1-of-4.safetensors", + "model.layers.6.self_attn.k_proj.weight": "model-1-of-4.safetensors", + "model.layers.6.self_attn.k_proj.bias": "model-1-of-4.safetensors", + "model.layers.6.self_attn.v_proj.weight": "model-1-of-4.safetensors", + "model.layers.6.self_attn.v_proj.bias": "model-1-of-4.safetensors", + "model.layers.6.self_attn.o_proj.weight": "model-1-of-4.safetensors", + "model.layers.6.mlp.gate_proj.weight": "model-1-of-4.safetensors", + "model.layers.6.mlp.up_proj.weight": "model-1-of-4.safetensors", + "model.layers.6.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.6.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.6.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.7.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.7.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.7.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.7.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.7.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.7.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.7.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.7.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.7.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.7.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.7.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.7.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.8.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.8.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.8.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.8.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.8.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.8.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.8.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.8.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.8.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.8.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.8.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.8.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.9.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.9.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.9.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.9.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.9.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.9.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.9.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.9.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.9.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.9.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.9.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.9.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.10.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.10.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.10.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.10.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.10.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.10.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.10.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.10.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.10.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.10.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.10.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.10.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.11.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.11.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.11.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.11.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.11.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.11.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.11.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.11.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.11.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.11.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.11.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.11.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.12.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.12.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.12.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.12.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.12.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.12.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.12.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.12.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.12.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.12.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.12.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.12.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.13.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.13.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.13.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.13.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.13.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.13.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.13.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.13.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.13.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.13.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.13.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.13.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.14.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.14.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.14.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.14.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.14.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.14.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.14.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.14.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.14.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.14.mlp.down_proj.weight": "model-2-of-4.safetensors", + "model.layers.14.input_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.14.post_attention_layernorm.weight": "model-2-of-4.safetensors", + "model.layers.15.self_attn.q_proj.weight": "model-2-of-4.safetensors", + "model.layers.15.self_attn.q_proj.bias": "model-2-of-4.safetensors", + "model.layers.15.self_attn.k_proj.weight": "model-2-of-4.safetensors", + "model.layers.15.self_attn.k_proj.bias": "model-2-of-4.safetensors", + "model.layers.15.self_attn.v_proj.weight": "model-2-of-4.safetensors", + "model.layers.15.self_attn.v_proj.bias": "model-2-of-4.safetensors", + "model.layers.15.self_attn.o_proj.weight": "model-2-of-4.safetensors", + "model.layers.15.mlp.gate_proj.weight": "model-2-of-4.safetensors", + "model.layers.15.mlp.up_proj.weight": "model-2-of-4.safetensors", + "model.layers.15.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.15.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.15.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.16.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.16.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.16.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.16.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.16.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.16.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.16.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.16.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.16.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.16.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.16.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.16.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.17.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.17.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.17.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.17.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.17.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.17.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.17.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.17.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.17.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.17.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.17.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.17.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.18.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.18.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.18.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.18.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.18.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.18.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.18.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.18.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.18.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.18.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.18.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.18.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.19.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.19.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.19.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.19.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.19.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.19.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.19.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.19.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.19.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.19.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.19.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.19.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.20.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.20.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.20.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.20.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.20.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.20.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.20.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.20.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.20.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.20.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.20.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.20.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.21.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.21.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.21.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.21.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.21.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.21.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.21.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.21.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.21.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.21.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.21.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.21.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.22.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.22.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.22.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.22.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.22.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.22.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.22.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.22.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.22.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.22.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.22.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.22.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.23.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.23.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.23.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.23.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.23.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.23.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.23.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.23.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.23.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.23.mlp.down_proj.weight": "model-3-of-4.safetensors", + "model.layers.23.input_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.23.post_attention_layernorm.weight": "model-3-of-4.safetensors", + "model.layers.24.self_attn.q_proj.weight": "model-3-of-4.safetensors", + "model.layers.24.self_attn.q_proj.bias": "model-3-of-4.safetensors", + "model.layers.24.self_attn.k_proj.weight": "model-3-of-4.safetensors", + "model.layers.24.self_attn.k_proj.bias": "model-3-of-4.safetensors", + "model.layers.24.self_attn.v_proj.weight": "model-3-of-4.safetensors", + "model.layers.24.self_attn.v_proj.bias": "model-3-of-4.safetensors", + "model.layers.24.self_attn.o_proj.weight": "model-3-of-4.safetensors", + "model.layers.24.mlp.gate_proj.weight": "model-3-of-4.safetensors", + "model.layers.24.mlp.up_proj.weight": "model-3-of-4.safetensors", + "model.layers.24.mlp.down_proj.weight": "model-4-of-4.safetensors", + "model.layers.24.input_layernorm.weight": "model-4-of-4.safetensors", + "model.layers.24.post_attention_layernorm.weight": "model-4-of-4.safetensors", + "model.layers.25.self_attn.q_proj.weight": "model-4-of-4.safetensors", + "model.layers.25.self_attn.q_proj.bias": "model-4-of-4.safetensors", + "model.layers.25.self_attn.k_proj.weight": "model-4-of-4.safetensors", + "model.layers.25.self_attn.k_proj.bias": "model-4-of-4.safetensors", + "model.layers.25.self_attn.v_proj.weight": "model-4-of-4.safetensors", + "model.layers.25.self_attn.v_proj.bias": "model-4-of-4.safetensors", + "model.layers.25.self_attn.o_proj.weight": "model-4-of-4.safetensors", + "model.layers.25.mlp.gate_proj.weight": "model-4-of-4.safetensors", + "model.layers.25.mlp.up_proj.weight": "model-4-of-4.safetensors", + "model.layers.25.mlp.down_proj.weight": "model-4-of-4.safetensors", + "model.layers.25.input_layernorm.weight": "model-4-of-4.safetensors", + "model.layers.25.post_attention_layernorm.weight": "model-4-of-4.safetensors", + "model.layers.26.self_attn.q_proj.weight": "model-4-of-4.safetensors", + "model.layers.26.self_attn.q_proj.bias": "model-4-of-4.safetensors", + "model.layers.26.self_attn.k_proj.weight": "model-4-of-4.safetensors", + "model.layers.26.self_attn.k_proj.bias": "model-4-of-4.safetensors", + "model.layers.26.self_attn.v_proj.weight": "model-4-of-4.safetensors", + "model.layers.26.self_attn.v_proj.bias": "model-4-of-4.safetensors", + "model.layers.26.self_attn.o_proj.weight": "model-4-of-4.safetensors", + "model.layers.26.mlp.gate_proj.weight": "model-4-of-4.safetensors", + "model.layers.26.mlp.up_proj.weight": "model-4-of-4.safetensors", + "model.layers.26.mlp.down_proj.weight": "model-4-of-4.safetensors", + "model.layers.26.input_layernorm.weight": "model-4-of-4.safetensors", + "model.layers.26.post_attention_layernorm.weight": "model-4-of-4.safetensors", + "model.layers.27.self_attn.q_proj.weight": "model-4-of-4.safetensors", + "model.layers.27.self_attn.q_proj.bias": "model-4-of-4.safetensors", + "model.layers.27.self_attn.k_proj.weight": "model-4-of-4.safetensors", + "model.layers.27.self_attn.k_proj.bias": "model-4-of-4.safetensors", + "model.layers.27.self_attn.v_proj.weight": "model-4-of-4.safetensors", + "model.layers.27.self_attn.v_proj.bias": "model-4-of-4.safetensors", + "model.layers.27.self_attn.o_proj.weight": "model-4-of-4.safetensors", + "model.layers.27.mlp.gate_proj.weight": "model-4-of-4.safetensors", + "model.layers.27.mlp.up_proj.weight": "model-4-of-4.safetensors", + "model.layers.27.mlp.down_proj.weight": "model-4-of-4.safetensors", + "model.layers.27.input_layernorm.weight": "model-4-of-4.safetensors", + "model.layers.27.post_attention_layernorm.weight": "model-4-of-4.safetensors", + "model.norm.weight": "model-4-of-4.safetensors", + "lm_head.weight": "model-4-of-4.safetensors" + } +} \ No newline at end of file diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..34510ff --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8 +size 11421892 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..5156d16 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,30 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|im_end|>", + "errors": "replace", + "extra_special_tokens": [ + "<|im_start|>", + "<|im_end|>", + "<|object_ref_start|>", + "<|object_ref_end|>", + "<|box_start|>", + "<|box_end|>", + "<|quad_start|>", + "<|quad_end|>", + "<|vision_start|>", + "<|vision_end|>", + "<|vision_pad|>", + "<|image_pad|>", + "<|video_pad|>" + ], + "is_local": false, + "local_files_only": false, + "model_max_length": 32768, + "pad_token": "<|endoftext|>", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null +}