portable runner: sys.path bootstrap + concrete precision resolution
Browse files
scripts/run_stage_portable.py
CHANGED
|
@@ -37,10 +37,17 @@ import math
|
|
| 37 |
import os
|
| 38 |
from pathlib import Path
|
| 39 |
import shutil
|
|
|
|
| 40 |
import tempfile
|
| 41 |
import time
|
| 42 |
import uuid
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
TARGET = 50_000_000_000
|
| 45 |
MAX_SESSION_SECONDS = 43_200
|
| 46 |
FORMAT = "pear15-portable-stage-runner.v1"
|
|
@@ -153,7 +160,12 @@ def run(mode, head_root, stage_root, data, *, seconds=7200, device="cuda",
|
|
| 153 |
if gradient_accumulation_steps is not None else cfg["gradient_accumulation_steps"])
|
| 154 |
grad_ckpt = (gradient_checkpointing
|
| 155 |
if gradient_checkpointing is not None else True)
|
| 156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
chunk = loss_chunk_tokens if loss_chunk_tokens is not None else min(
|
| 158 |
cfg["loss_chunk_tokens"], micro * seq)
|
| 159 |
cfg.update(
|
|
|
|
| 37 |
import os
|
| 38 |
from pathlib import Path
|
| 39 |
import shutil
|
| 40 |
+
import sys
|
| 41 |
import tempfile
|
| 42 |
import time
|
| 43 |
import uuid
|
| 44 |
|
| 45 |
+
# The pear15 package sits next to scripts/ (repo root locally, CODE/ on Kaggle).
|
| 46 |
+
_HERE = Path(__file__).resolve().parent
|
| 47 |
+
_REPO_ROOT = str(_HERE.parent)
|
| 48 |
+
if _REPO_ROOT not in sys.path:
|
| 49 |
+
sys.path.insert(0, _REPO_ROOT)
|
| 50 |
+
|
| 51 |
TARGET = 50_000_000_000
|
| 52 |
MAX_SESSION_SECONDS = 43_200
|
| 53 |
FORMAT = "pear15-portable-stage-runner.v1"
|
|
|
|
| 160 |
if gradient_accumulation_steps is not None else cfg["gradient_accumulation_steps"])
|
| 161 |
grad_ckpt = (gradient_checkpointing
|
| 162 |
if gradient_checkpointing is not None else True)
|
| 163 |
+
# Resolve now (idempotent with the trainer's own resolution) so lineage,
|
| 164 |
+
# stage-head and the saved config all carry a CONCRETE precision. An
|
| 165 |
+
# 'auto' recorded verbatim would make the next session think the stage
|
| 166 |
+
# is unresumable and silently migrate again.
|
| 167 |
+
resolved_precision = core._resolve_precision(
|
| 168 |
+
torch, device, precision or "auto")
|
| 169 |
chunk = loss_chunk_tokens if loss_chunk_tokens is not None else min(
|
| 170 |
cfg["loss_chunk_tokens"], micro * seq)
|
| 171 |
cfg.update(
|