Leszek Bukowski commited on
Commit ·
3b640fd
1
Parent(s): eee98a7
Check Colab runtime compatibility before setup
Browse filesFiles changed (2)
- README.md+4-1
- notebook.ipynb+2-2
30 unmodified lines3132333435363730 unmodified linesThe notebook itself uses a hidden Hugging Face read-token prompt for resources.Use a Linux NVIDIA runtime with native BF16 andat least **40 GiB VRAM**. The notebook installs the pinned CUDA 13.0 stack,verifies the release wheel and model hashes, and presents editable writing andDecision JSON examples. Private staging requires a Hugging Face read token; donot save credentials in notebook source or output. Base-model download is about 18 GB.30 unmodified lines3132333435363738394030 unmodified linesThe notebook itself uses a hidden Hugging Face read-token prompt for resources.Use a Linux NVIDIA runtime with native BF16 andat least **40 GiB VRAM**, using Python **3.12**. In Colab, select runtime version**2026.07** and check the actual GPU allocation before installing packages.Colab may substitute a smaller GPU; an A100 labelled 40 GB can report less than40 GiB. The notebook installs the pinned CUDA 13.0 stack,verifies the release wheel and model hashes, and presents editable writing andDecision JSON examples. Private staging requires a Hugging Face read token; donot save credentials in notebook source or output. Base-model download is about 18 GB.
9 unmodified lines101112131415161 unmodified line181920212223249 unmodified lines"cell_type": "markdown","id": "prerequisites","metadata": {},"source": "## Before you start\n\nUse a **Linux NVIDIA GPU with native BF16 and at least 40 GiB of GPU memory**.\nThe recorded recipe uses Python 3.12, CUDA 13.0, PyTorch 2.14.0 and Transformers 5.17.0.\nFree Colab T4 runtimes are not supported. This notebook does not quantize the model.\nAllow about 18 GB for Qwen, plus package downloads and working files.\n\nRun the cells in order. Setup may ask for **one kernel restart**; after restarting,\nrun all cells again. Keep your Hugging Face read token private. During private staging,\nyour account must have access to the two model repositories and the dataset repository.\n"},{"cell_type": "code",1 unmodified line"metadata": {},"execution_count": null,"outputs": [],"source": "import os\nimport sys\nimport platform\nimport shutil\nimport subprocess\nfrom pathlib import Path\n\nif platform.system() != \"Linux\":\n raise RuntimeError(\"Use a supported Linux NVIDIA GPU runtime. This notebook is not a Mac/CPU demo.\")\nif not shutil.which(\"nvidia-smi\"):\n raise RuntimeError(\"No NVIDIA GPU found. Select a GPU runtime, then run this cell again.\")\nprint(\"Python:\", platform.python_version())\nsubprocess.run([\"nvidia-smi\", \"--query-gpu=name,memory.total\", \"--format=csv,noheader\"], check=True)\nprint(\"Setup will verify the exact stack and the 40 GiB/native-BF16 requirements.\")\n"},{"cell_type": "markdown",9 unmodified lines101112131415161 unmodified line181920212223249 unmodified lines"cell_type": "markdown","id": "prerequisites","metadata": {},"source": "## Before you start\n\nUse a **Linux NVIDIA GPU with native BF16 and at least 40 GiB of GPU memory**.\nThe recorded recipe uses Python 3.12, CUDA 13.0, PyTorch 2.14.0 and Transformers 5.17.0.\nFree Colab T4 runtimes are not supported. This notebook does not quantize the model.\nAllow about 18 GB for Qwen, plus package downloads and working files.\n\nIn Colab, select **Runtime → Change runtime type → Runtime version 2026.07**\nfor Python 3.12. See [Colab's runtime versions](https://research.google.com/colaboratory/runtime-version-faq.html).\nThe first cell checks Python and GPU memory before installing anything; native BF16\nsupport is verified after setup. A GPU sold as “40 GB” may report less than 40 GiB;\nthe requirement uses the memory actually reported by the runtime.\n\nRun the cells in order. Setup may ask for **one kernel restart**; after restarting,\nrun all cells again. Keep your Hugging Face read token private. During private staging,\nyour account must have access to the two model repositories and the dataset repository.\n"},{"cell_type": "code",1 unmodified line"metadata": {},"execution_count": null,"outputs": [],"source": "import csv\nimport math\nimport os\nimport sys\nimport platform\nimport shutil\nimport subprocess\nfrom pathlib import Path\n\nprint(\"Python:\", platform.python_version(), flush=True)\nif sys.version_info[:2] != (3, 12):\n raise RuntimeError(\n \"Python 3.12 is required. In Colab, select Runtime → Change runtime type → \"\n \"Runtime version 2026.07, reconnect, then Run all again. \"\n \"For a local kernel, create a Python 3.12 environment. No packages were installed.\"\n )\nif platform.system() != \"Linux\":\n raise RuntimeError(\"Use a supported Linux NVIDIA GPU runtime. This notebook is not a Mac/CPU demo.\")\nif not shutil.which(\"nvidia-smi\"):\n raise RuntimeError(\"No NVIDIA GPU found. Select a GPU runtime, then run this cell again.\")\ngpu_id = os.environ.get(\"CUDA_VISIBLE_DEVICES\", \"0\").split(\",\")[0].strip()\nif not gpu_id or gpu_id == \"-1\":\n raise RuntimeError(\"CUDA_VISIBLE_DEVICES hides all GPUs. Select a visible NVIDIA GPU, then retry.\")\ngpu_info = subprocess.run(\n [\"nvidia-smi\", f\"--id={gpu_id}\", \"--query-gpu=name,driver_version,memory.total\",\n \"--format=csv,noheader,nounits\"],\n check=True, capture_output=True, text=True, timeout=30,\n)\nprint(\"NVIDIA GPU — name, driver, total memory (MiB):\", flush=True)\nprint(gpu_info.stdout.strip(), flush=True)\ntry:\n gpu_row = next(csv.reader(gpu_info.stdout.splitlines(), skipinitialspace=True))\n memory_gib = float(gpu_row[2]) / 1024\nexcept (StopIteration, IndexError, ValueError) as exc:\n raise RuntimeError(\"Could not read GPU memory from nvidia-smi. Check the output above before installing.\") from exc\nif not math.isfinite(memory_gib) or memory_gib < 40:\n raise RuntimeError(\n f\"At least 40 GiB of memory on one GPU is required; detected {memory_gib:.2f} GiB. \"\n \"Select a larger GPU runtime before continuing. No packages were installed.\"\n )\nprint(f\"Preflight passed: Python 3.12 and {memory_gib:.2f} GiB GPU memory.\", flush=True)\nprint(\"Setup will verify the exact stack and native BF16 support before loading a model.\", flush=True)\n"},{"cell_type": "markdown",
README.md+4-1
notebook.ipynb+2-2