diff options
| author | yurenh <blackhao0426@gmail.com> | 2026-08-31 18:33:06 -0500 |
|---|---|---|
| committer | yurenh <blackhao0426@gmail.com> | 2026-08-31 18:33:06 -0500 |
| commit | f68f6b00f047d9412113d7c2627bd7f6e96f2d62 (patch) | |
| tree | 611ee8daf2b7ad04c2492ee3521d31c01a1f96b7 /scripts/env_check.py | |
| parent | 5e5f56cff99fe017c08d56d1303773d1299c0e38 (diff) | |
env bootstrap (optional venv) + self-check in the ladder runner
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GkgLsACEF6CCP7EUfA5fZe
Diffstat (limited to 'scripts/env_check.py')
| -rw-r--r-- | scripts/env_check.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/env_check.py b/scripts/env_check.py new file mode 100644 index 0000000..92d18a1 --- /dev/null +++ b/scripts/env_check.py @@ -0,0 +1,23 @@ +"""Fast environment self-check with actionable messages. Exit 0 = ready to train.""" +import sys + +ok = True +def item(name, fn, hint): + global ok + try: + msg = fn() + print(f" [ok] {name}: {msg}") + except Exception as e: + ok = False + print(f" [FAIL] {name}: {type(e).__name__}: {e}\n -> {hint}") + +print("== zbp-scaling environment check") +item("python >= 3.10", lambda: (sys.version.split()[0], 1/0 if sys.version_info < (3, 10) else "")[0], "use python3.10+") +item("torch + CUDA", lambda: __import__("torch").__version__ + f", {__import__('torch').cuda.device_count()} GPU(s)" + + ("" if __import__("torch").cuda.is_available() else (_ for _ in ()).throw(RuntimeError("cuda not available"))), + "install a CUDA build of torch (pip install torch --index-url https://download.pytorch.org/whl/cu126) or load the cluster module") +item("zbp_scaling package", lambda: __import__("zbp_scaling").__name__, "pip install -e . (from the repo root)") +item("numpy / yaml / datasets", lambda: ",".join(__import__(m).__name__ for m in ("numpy", "yaml", "datasets")), "pip install -e .") +item("tiktoken GPT-2 vocab", lambda: f"{__import__('tiktoken').get_encoding('gpt2').n_vocab} tokens", + "first use needs network to fetch the BPE files; on air-gapped nodes pre-seed the tiktoken cache dir") +print("== ready" if ok else "== NOT ready"); sys.exit(0 if ok else 1) |
