diff --git a/notebooks/colab-phase1-eval.ipynb b/notebooks/colab-phase1-eval.ipynb index dcba2ee..f94cfe4 100644 --- a/notebooks/colab-phase1-eval.ipynb +++ b/notebooks/colab-phase1-eval.ipynb @@ -15,10 +15,19 @@ "CATEGORIES = 'bugfix,feature' # or 'refactor'\n", "import os, json, subprocess, sys, time, glob, shutil, urllib.request\n", "print('python', sys.version.split()[0], '| scope:', SCOPE, '| categories:', CATEGORIES)\n", - "print(subprocess.run(['nvidia-smi'], capture_output=True, text=True).stdout[:900])\n", - "gpu = subprocess.run(['nvidia-smi', '--query-gpu=memory.total,name', '--format=csv,noheader'], capture_output=True, text=True).stdout.strip().splitlines()\n", + "# nvidia-smi is absent on CPU-only runtimes (no NVIDIA driver). Guard so the\n", + "# cell reports the situation instead of crashing with FileNotFoundError.\n", + "def nvidia_smi(*args):\n", + " try:\n", + " return subprocess.run(['nvidia-smi', *args], capture_output=True, text=True, timeout=30).stdout\n", + " except (FileNotFoundError, subprocess.TimeoutExpired):\n", + " return ''\n", + "print((nvidia_smi() or 'nvidia-smi NOT FOUND (CPU-only runtime — no NVIDIA driver).').strip()[:900])\n", + "gpu = nvidia_smi('--query-gpu=memory.total,name', '--format=csv,noheader').strip().splitlines()\n", "vram = sum(int(line.split()[0].replace(',', '')) for line in gpu if line) if gpu else 0\n", "print('GPU count:', len(gpu), '| total VRAM MiB:', vram)\n", + "if not gpu:\n", + " print('WARNING: no GPU detected — eval will run on CPU (slow). Set Runtime -> Change runtime type -> Hardware accelerator: T4 GPU')\n", "if SCOPE == 'full':\n", " assert vram >= 20000, 'full scope needs >=20GB VRAM (L4/A100) — T4 15GB cannot hold 27B Q4; change runtime type'\n", "elif vram < 8000:\n", @@ -218,9 +227,16 @@ } ], "metadata": { - "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, - "language_info": {"name": "python", "version": "3.11"} + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.11" + } }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/notebooks/phase1-pipeline-eval.ipynb b/notebooks/phase1-pipeline-eval.ipynb index b2460a4..9900268 100644 --- a/notebooks/phase1-pipeline-eval.ipynb +++ b/notebooks/phase1-pipeline-eval.ipynb @@ -9,7 +9,12 @@ "import os, json, subprocess, sys, time, glob, shutil, urllib.request\n", "CATEGORIES = 'bugfix,feature'\n", "print('python', sys.version.split()[0], '| categories:', CATEGORIES)\n", - "print(subprocess.run(['nvidia-smi'], capture_output=True, text=True).stdout[:800])\n" + "def nvidia_smi(*args):\n", + " try:\n", + " return subprocess.run(['nvidia-smi', *args], capture_output=True, text=True, timeout=30).stdout\n", + " except (FileNotFoundError, subprocess.TimeoutExpired):\n", + " return ''\n", + "print((nvidia_smi() or 'nvidia-smi NOT FOUND (CPU-only runtime — no NVIDIA driver).').strip()[:800])\n" ] }, { @@ -74,7 +79,7 @@ "outputs": [], "source": [ "# CUDA layout on Kaggle (diag-verified): toolkit 12.8, driver lib ONLY in\n", - "# /usr/local/cuda-12.8/compat \u2014 symlink into toolkit lib64 for CMake.\n", + "# /usr/local/cuda-12.8/compat — symlink into toolkit lib64 for CMake.\n", "COMPAT = '/usr/local/cuda-12.8/compat'\n", "for lib in ['libcuda.so', 'libcuda.so.1']:\n", " src = COMPAT + '/' + lib\n", @@ -103,7 +108,7 @@ "bin_path = '/kaggle/working/llama.cpp/build/bin/llama-server'\n", "assert os.path.exists(bin_path), 'llama-server build failed'\n", "# Trim build footprint but KEEP the shared libs: llama-server links\n", - "# libggml-cuda.so etc from build/bin \u2014 copying only the binary broke exec\n", + "# libggml-cuda.so etc from build/bin — copying only the binary broke exec\n", "# (rc=127, missing libs) on run 9. Copy the whole bin dir + ldd sanity.\n", "subprocess.run(['cp', '-r', '/kaggle/working/llama.cpp/build/bin', '/kaggle/working/llama-bin'], check=True)\n", "subprocess.run(['rm', '-rf', '/kaggle/working/llama.cpp'])\n", @@ -141,7 +146,7 @@ " print((r.stdout or '')[-2500:])\n", " print((r.stderr or '')[-1000:])\n", "except subprocess.TimeoutExpired:\n", - " print('PIPELINE TIMEOUT after', round((time.time() - t0) / 60, 1), 'min \u2014 partial results kept')\n", + " print('PIPELINE TIMEOUT after', round((time.time() - t0) / 60, 1), 'min — partial results kept')\n", "# Keep the kernel output small: the models/ dir (fallback downloads) would\n", "# bloat /kaggle/working into the output snapshot and break result fetches.\n", "shutil.rmtree('/kaggle/working/models', ignore_errors=True)\n",