From 2142d440dfe3bea981d1b5a3e9398645f223ea5f Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 2 Jun 2026 02:28:43 +0900 Subject: [PATCH] fix: make author-machine paths portable + add portable-path CI gate Replace hardcoded author-machine absolute paths (/home/summer/runs, /Users/ghost/..., /Users/mini/...) with portable resolution so the repo runs on any checkout. RUNTIME (env -> portable default; never a foreign literal): - lm_foundry/tool/build_sft_dataset_v{4..14}.py, synth_apple_sft.py: runs root now $HEXA_RUNS_DIR, default ~/runs (was /home/summer/runs). - lm_foundry/tool/hexa_s0_scorer.py: hexa-cc binary resolved via $HEXA_CC_BIN -> on-PATH hexa-cc -> ~/.hx/build default; fail-fast kept. - lm_foundry/tool/runpod_launch_7b_sft.sh, recover_hf_uploads.sh: HF-token fetch via $HF_TOKEN_CMD / $HF_TOKEN_HOST (secret CLI from PATH); GGUF/bench paths via $HEXA_RUNS_DIR (default ~/runs). TEST FIXTURE: - tests/test_install_hexa.py: fallback hexa VM path -> $HEXA_BIN / ~/.hx/bin/hexa (still prefers `hexa` on PATH). COMMENT/DOC: - install.hexa, verify/numerics_bitnet_bt77_n6_lattice.hexa, LAB-09 phi_llm_stress_harness.hexa, tests/conftest.py, bench_humaneval.py / score_with_adapter.py docstrings: genericize provenance comments / usage examples. PREVENTION: - .github/workflows/portable-path-gate.yml: pure-bash PR gate failing any ADDED non-comment source line introducing /Users// or /home//. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/portable-path-gate.yml | 23 ++++++++++++++ .../phi_llm_stress_harness.hexa | 2 +- install.hexa | 2 +- lm_foundry/tool/bench_humaneval.py | 2 +- lm_foundry/tool/build_sft_dataset_v10.py | 11 ++++--- lm_foundry/tool/build_sft_dataset_v11.py | 11 ++++--- lm_foundry/tool/build_sft_dataset_v12.py | 11 ++++--- lm_foundry/tool/build_sft_dataset_v13.py | 11 ++++--- lm_foundry/tool/build_sft_dataset_v14.py | 11 ++++--- lm_foundry/tool/build_sft_dataset_v4.py | 9 ++++-- lm_foundry/tool/build_sft_dataset_v5.py | 13 ++++---- lm_foundry/tool/build_sft_dataset_v6.py | 11 ++++--- lm_foundry/tool/build_sft_dataset_v7.py | 9 ++++-- lm_foundry/tool/build_sft_dataset_v8.py | 11 ++++--- lm_foundry/tool/build_sft_dataset_v9.py | 11 ++++--- lm_foundry/tool/hexa_s0_scorer.py | 17 ++++++++++- lm_foundry/tool/recover_hf_uploads.sh | 30 ++++++++++++------- lm_foundry/tool/runpod_launch_7b_sft.sh | 7 +++-- lm_foundry/tool/score_with_adapter.py | 2 +- lm_foundry/tool/synth_apple_sft.py | 6 ++-- tests/conftest.py | 2 +- tests/test_install_hexa.py | 10 +++++-- verify/numerics_bitnet_bt77_n6_lattice.hexa | 2 +- 23 files changed, 157 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/portable-path-gate.yml diff --git a/.github/workflows/portable-path-gate.yml b/.github/workflows/portable-path-gate.yml new file mode 100644 index 0000000..60e7dc6 --- /dev/null +++ b/.github/workflows/portable-path-gate.yml @@ -0,0 +1,23 @@ +name: portable-path-gate +on: + pull_request: { branches: [main] } + workflow_dispatch: +permissions: { contents: read } +jobs: + no-foreign-path: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + with: { fetch-depth: 0 } + - shell: bash + run: | + set -euo pipefail + base="origin/${{ github.base_ref }}" + git fetch --quiet origin "${{ github.base_ref }}" + hits="$(git diff -U0 "$base...HEAD" -- '*.hexa' '*.py' '*.sh' '*.swift' '*.ts' '*.js' '*.rs' '*.c' '*.go' \ + | grep -E '^\+[^+]' | sed -E 's/^\+//' \ + | grep -E '/(Users|home)/[A-Za-z][A-Za-z0-9._-]+/' \ + | grep -vE '^[[:space:]]*(//|#|\*)' || true)" + if [ -n "$hits" ]; then echo "๐Ÿšซ FAIL"; echo "$hits"; exit 1; fi + echo "โœ… PASS" diff --git a/LAB/lab-09-consciousness-directionality/phi_llm_stress_harness.hexa b/LAB/lab-09-consciousness-directionality/phi_llm_stress_harness.hexa index 51e93ee..041845f 100644 --- a/LAB/lab-09-consciousness-directionality/phi_llm_stress_harness.hexa +++ b/LAB/lab-09-consciousness-directionality/phi_llm_stress_harness.hexa @@ -35,7 +35,7 @@ // ANIMA GROUNDING (prior art): // H_191 (non-autoregressive / ALM-free consciousness 3-axis) ยท H_004 (recurrent // S_real Phi=0.538 vs zombie playback Phi~0) ยท H_220 (mirror self / self-vs-other), -// at /Users/mini/dancinlab/anima/.worktrees/h869-dispatch-kl/UNIVERSE/. +// in the anima repo's UNIVERSE/ tree (handoff h869-dispatch-kl). // // HONESTY (cx_lab_sandbox ยท g5): // Pure-local, $0, no network, no external API. Base = locally-cached Qwen2.5-1.5B diff --git a/install.hexa b/install.hexa index d58f540..8315f9d 100644 --- a/install.hexa +++ b/install.hexa @@ -1,7 +1,7 @@ // install.hexa โ€” hx build hook for hexa-codex. // // Invoked by `hx install hexa-codex` (hexa-lang package manager) right after -// the GitHub checkout (or symlink from /Users/ghost/core/hexa-codex) lands in +// the GitHub checkout (or a local symlink to the hexa-codex repo) lands in // $HX_PKG_DIR. hx passes: // HX_PKG_DIR โ€” absolute path to the package root // HX_BIN_DIR โ€” ~/.hx/bin diff --git a/lm_foundry/tool/bench_humaneval.py b/lm_foundry/tool/bench_humaneval.py index 065b929..d5e3e1c 100755 --- a/lm_foundry/tool/bench_humaneval.py +++ b/lm_foundry/tool/bench_humaneval.py @@ -8,7 +8,7 @@ USAGE python3 tool/bench_humaneval.py \\ --model Qwen/Qwen2.5-Coder-1.5B \\ - --output /home/summer/runs/bench-cold-v0.1.3/qwen2.5-coder-1.5b/ \\ + --output ~/runs/bench-cold-v0.1.3/qwen2.5-coder-1.5b/ \\ --num-tasks 164 # full set ; 0 = unlimited OUTPUT diff --git a/lm_foundry/tool/build_sft_dataset_v10.py b/lm_foundry/tool/build_sft_dataset_v10.py index 36be7f4..ffb27ae 100644 --- a/lm_foundry/tool/build_sft_dataset_v10.py +++ b/lm_foundry/tool/build_sft_dataset_v10.py @@ -11,8 +11,8 @@ v10 = v9 base (2,303) + ~70 RunPod / cloud-GPU ops Q/A pairs. OUTPUT - /home/summer/runs/sft-train-v10/train.jsonl - /home/summer/runs/sft-train-v10/MANIFEST.json + $HEXA_RUNS_DIR/sft-train-v10/train.jsonl (default ~/runs/...) + $HEXA_RUNS_DIR/sft-train-v10/MANIFEST.json """ from __future__ import annotations import os as _os @@ -26,8 +26,11 @@ random.seed(42) -V9_BASE = Path("/home/summer/runs/sft-train-v9/train.jsonl") -OUT_DIR = Path("/home/summer/runs/sft-train-v10") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V9_BASE = RUNS / "sft-train-v9" / "train.jsonl" +OUT_DIR = RUNS / "sft-train-v10" OUT = OUT_DIR / "train.jsonl" MANIFEST = OUT_DIR / "MANIFEST.json" diff --git a/lm_foundry/tool/build_sft_dataset_v11.py b/lm_foundry/tool/build_sft_dataset_v11.py index c6980ef..8abe89d 100644 --- a/lm_foundry/tool/build_sft_dataset_v11.py +++ b/lm_foundry/tool/build_sft_dataset_v11.py @@ -15,8 +15,8 @@ Total v11: ~2,516 rows. OUTPUT - /home/summer/runs/sft-train-v11/train.jsonl - /home/summer/runs/sft-train-v11/MANIFEST.json + $HEXA_RUNS_DIR/sft-train-v11/train.jsonl (default ~/runs/...) + $HEXA_RUNS_DIR/sft-train-v11/MANIFEST.json """ from __future__ import annotations import os as _os @@ -30,8 +30,11 @@ random.seed(42) -V10_BASE = Path("/home/summer/runs/sft-train-v10/train.jsonl") -OUT_DIR = Path("/home/summer/runs/sft-train-v11") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V10_BASE = RUNS / "sft-train-v10" / "train.jsonl" +OUT_DIR = RUNS / "sft-train-v11" OUT = OUT_DIR / "train.jsonl" MANIFEST = OUT_DIR / "MANIFEST.json" diff --git a/lm_foundry/tool/build_sft_dataset_v12.py b/lm_foundry/tool/build_sft_dataset_v12.py index a955f09..9ba4757 100644 --- a/lm_foundry/tool/build_sft_dataset_v12.py +++ b/lm_foundry/tool/build_sft_dataset_v12.py @@ -16,8 +16,8 @@ Total v12: ~2,840 rows. OUTPUT - /home/summer/runs/sft-train-v12/train.jsonl - /home/summer/runs/sft-train-v12/MANIFEST.json + $HEXA_RUNS_DIR/sft-train-v12/train.jsonl (default ~/runs/...) + $HEXA_RUNS_DIR/sft-train-v12/MANIFEST.json """ from __future__ import annotations import os as _os @@ -31,8 +31,11 @@ random.seed(42) -V11_BASE = Path("/home/summer/runs/sft-train-v11/train.jsonl") -OUT_DIR = Path("/home/summer/runs/sft-train-v12") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V11_BASE = RUNS / "sft-train-v11" / "train.jsonl" +OUT_DIR = RUNS / "sft-train-v12" OUT = OUT_DIR / "train.jsonl" MANIFEST = OUT_DIR / "MANIFEST.json" diff --git a/lm_foundry/tool/build_sft_dataset_v13.py b/lm_foundry/tool/build_sft_dataset_v13.py index b26c5d4..045f5ed 100644 --- a/lm_foundry/tool/build_sft_dataset_v13.py +++ b/lm_foundry/tool/build_sft_dataset_v13.py @@ -17,8 +17,8 @@ epochs. See ROADMAP round 27.) OUTPUT - /home/summer/runs/sft-train-v13/train.jsonl - /home/summer/runs/sft-train-v13/MANIFEST.json + $HEXA_RUNS_DIR/sft-train-v13/train.jsonl (default ~/runs/...) + $HEXA_RUNS_DIR/sft-train-v13/MANIFEST.json """ from __future__ import annotations import os as _os @@ -35,8 +35,11 @@ random.seed(42) -V11_BASE = Path("/home/summer/runs/sft-train-v11/train.jsonl") -OUT_DIR = Path("/home/summer/runs/sft-train-v13") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V11_BASE = RUNS / "sft-train-v11" / "train.jsonl" +OUT_DIR = RUNS / "sft-train-v13" OUT = OUT_DIR / "train.jsonl" MANIFEST = OUT_DIR / "MANIFEST.json" diff --git a/lm_foundry/tool/build_sft_dataset_v14.py b/lm_foundry/tool/build_sft_dataset_v14.py index 03dd6b2..5452b79 100644 --- a/lm_foundry/tool/build_sft_dataset_v14.py +++ b/lm_foundry/tool/build_sft_dataset_v14.py @@ -23,8 +23,8 @@ Q/A pairs. ~2,640 rows. OUTPUT - /home/summer/runs/sft-train-v14/train.jsonl - /home/summer/runs/sft-train-v14/MANIFEST.json + $HEXA_RUNS_DIR/sft-train-v14/train.jsonl (default ~/runs/...) + $HEXA_RUNS_DIR/sft-train-v14/MANIFEST.json """ from __future__ import annotations import os as _os @@ -38,8 +38,11 @@ random.seed(42) -V11_BASE = Path("/home/summer/runs/sft-train-v11/train.jsonl") -OUT_DIR = Path("/home/summer/runs/sft-train-v14") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V11_BASE = RUNS / "sft-train-v11" / "train.jsonl" +OUT_DIR = RUNS / "sft-train-v14" OUT = OUT_DIR / "train.jsonl" MANIFEST = OUT_DIR / "MANIFEST.json" diff --git a/lm_foundry/tool/build_sft_dataset_v4.py b/lm_foundry/tool/build_sft_dataset_v4.py index dec4d00..764a185 100755 --- a/lm_foundry/tool/build_sft_dataset_v4.py +++ b/lm_foundry/tool/build_sft_dataset_v4.py @@ -20,7 +20,7 @@ Plus the v3 base (1314 rows) โ†’ total ~1560 rows for v4. OUTPUT - /home/summer/runs/sft-train-v4/train.jsonl + $HEXA_RUNS_DIR/sft-train-v4/train.jsonl (default ~/runs/...) """ from __future__ import annotations import os as _os @@ -35,8 +35,11 @@ random.seed(42) -OUT = Path("/home/summer/runs/sft-train-v4/train.jsonl") -V3_BASE = Path("/home/summer/runs/sft-train-v3/train.jsonl") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +OUT = RUNS / "sft-train-v4" / "train.jsonl" +V3_BASE = RUNS / "sft-train-v3" / "train.jsonl" def fmt(prompt: str, completion: str) -> dict: diff --git a/lm_foundry/tool/build_sft_dataset_v5.py b/lm_foundry/tool/build_sft_dataset_v5.py index d829498..f5277b0 100755 --- a/lm_foundry/tool/build_sft_dataset_v5.py +++ b/lm_foundry/tool/build_sft_dataset_v5.py @@ -15,7 +15,7 @@ Total: ~1,765 rows. OUTPUT - /home/summer/runs/sft-train-v5/train.jsonl + $HEXA_RUNS_DIR/sft-train-v5/train.jsonl (default ~/runs/...) """ from __future__ import annotations import os as _os @@ -28,10 +28,13 @@ random.seed(42) -V4_BASE = Path("/home/summer/runs/sft-train-v4/train.jsonl") -APPLE_PAIRS = Path("/home/summer/runs/sft-apple/apple_pairs.jsonl") -SWIFT_CORPUS = Path("/home/summer/runs/corpus/stack-v1-swift/swift") -OUT = Path("/home/summer/runs/sft-train-v5/train.jsonl") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V4_BASE = RUNS / "sft-train-v4" / "train.jsonl" +APPLE_PAIRS = RUNS / "sft-apple" / "apple_pairs.jsonl" +SWIFT_CORPUS = RUNS / "corpus" / "stack-v1-swift" / "swift" +OUT = RUNS / "sft-train-v5" / "train.jsonl" def fmt(prompt, completion): diff --git a/lm_foundry/tool/build_sft_dataset_v6.py b/lm_foundry/tool/build_sft_dataset_v6.py index 9da1cdc..84f1a43 100755 --- a/lm_foundry/tool/build_sft_dataset_v6.py +++ b/lm_foundry/tool/build_sft_dataset_v6.py @@ -10,7 +10,7 @@ Q/A pairs. SwiftUI / UIKit / Combine knowledge stays; no continuation drift. OUTPUT - /home/summer/runs/sft-train-v6/train.jsonl + $HEXA_RUNS_DIR/sft-train-v6/train.jsonl (default ~/runs/...) """ from __future__ import annotations import os as _os @@ -21,9 +21,12 @@ import json from pathlib import Path -V4_BASE = Path("/home/summer/runs/sft-train-v4/train.jsonl") -APPLE = Path("/home/summer/runs/sft-apple/apple_pairs.jsonl") -OUT = Path("/home/summer/runs/sft-train-v6/train.jsonl") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V4_BASE = RUNS / "sft-train-v4" / "train.jsonl" +APPLE = RUNS / "sft-apple" / "apple_pairs.jsonl" +OUT = RUNS / "sft-train-v6" / "train.jsonl" def main(): diff --git a/lm_foundry/tool/build_sft_dataset_v7.py b/lm_foundry/tool/build_sft_dataset_v7.py index 9b338af..74eb9df 100755 --- a/lm_foundry/tool/build_sft_dataset_v7.py +++ b/lm_foundry/tool/build_sft_dataset_v7.py @@ -20,7 +20,7 @@ Total v7: ~1,985 rows. OUTPUT - /home/summer/runs/sft-train-v7/train.jsonl + $HEXA_RUNS_DIR/sft-train-v7/train.jsonl (default ~/runs/...) """ from __future__ import annotations import os as _os @@ -33,8 +33,11 @@ random.seed(42) -V6_BASE = Path("/home/summer/runs/sft-train-v6/train.jsonl") -OUT = Path("/home/summer/runs/sft-train-v7/train.jsonl") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V6_BASE = RUNS / "sft-train-v6" / "train.jsonl" +OUT = RUNS / "sft-train-v7" / "train.jsonl" def fmt(p, c): diff --git a/lm_foundry/tool/build_sft_dataset_v8.py b/lm_foundry/tool/build_sft_dataset_v8.py index c2fc5a2..2811aa7 100755 --- a/lm_foundry/tool/build_sft_dataset_v8.py +++ b/lm_foundry/tool/build_sft_dataset_v8.py @@ -24,8 +24,8 @@ recipe-shaped โ€” not file continuations (the v5 over-continuation regression). OUTPUT - /home/summer/runs/sft-train-v8/train.jsonl - /home/summer/runs/sft-train-v8/MANIFEST.json + $HEXA_RUNS_DIR/sft-train-v8/train.jsonl (default ~/runs/...) + $HEXA_RUNS_DIR/sft-train-v8/MANIFEST.json """ from __future__ import annotations import os as _os @@ -39,8 +39,11 @@ random.seed(42) -V7_BASE = Path("/home/summer/runs/sft-train-v8/.._v7_base") if False else Path("/home/summer/runs/sft-train-v7/train.jsonl") -OUT_DIR = Path("/home/summer/runs/sft-train-v8") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V7_BASE = RUNS / "sft-train-v7" / "train.jsonl" +OUT_DIR = RUNS / "sft-train-v8" OUT = OUT_DIR / "train.jsonl" MANIFEST = OUT_DIR / "MANIFEST.json" diff --git a/lm_foundry/tool/build_sft_dataset_v9.py b/lm_foundry/tool/build_sft_dataset_v9.py index 2c706e2..fbe58e0 100644 --- a/lm_foundry/tool/build_sft_dataset_v9.py +++ b/lm_foundry/tool/build_sft_dataset_v9.py @@ -17,8 +17,8 @@ Total v9: ~2,340 rows. OUTPUT - /home/summer/runs/sft-train-v9/train.jsonl - /home/summer/runs/sft-train-v9/MANIFEST.json + $HEXA_RUNS_DIR/sft-train-v9/train.jsonl (default ~/runs/...) + $HEXA_RUNS_DIR/sft-train-v9/MANIFEST.json """ from __future__ import annotations import os as _os @@ -32,8 +32,11 @@ random.seed(42) -V8_BASE = Path("/home/summer/runs/sft-train-v8/train.jsonl") -OUT_DIR = Path("/home/summer/runs/sft-train-v9") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) + +V8_BASE = RUNS / "sft-train-v8" / "train.jsonl" +OUT_DIR = RUNS / "sft-train-v9" OUT = OUT_DIR / "train.jsonl" MANIFEST = OUT_DIR / "MANIFEST.json" diff --git a/lm_foundry/tool/hexa_s0_scorer.py b/lm_foundry/tool/hexa_s0_scorer.py index d5d26f6..d9a1948 100755 --- a/lm_foundry/tool/hexa_s0_scorer.py +++ b/lm_foundry/tool/hexa_s0_scorer.py @@ -35,7 +35,22 @@ from pathlib import Path from typing import Tuple -HEXA_CC_BIN = Path("/home/summer/mac_home/core/hexa-lang/build/hexa_v2_linux_x86_64") +# Portable hexa-cc binary location: $HEXA_CC_BIN overrides; else the on-PATH +# `hexa-cc`/`hexa_v2_linux_x86_64`; else a default under ~/.hx/build. The caller +# fails fast (bin_path.exists() check below) when no binary is found. +def _default_cc_bin() -> Path: + env = _os.environ.get("HEXA_CC_BIN") + if env: + return Path(env) + import shutil as _shutil + for name in ("hexa-cc", "hexa_v2_linux_x86_64"): + found = _shutil.which(name) + if found: + return Path(found) + return Path.home() / ".hx" / "build" / "hexa_v2_linux_x86_64" + + +HEXA_CC_BIN = _default_cc_bin() TIMEOUT_S = 10.0 diff --git a/lm_foundry/tool/recover_hf_uploads.sh b/lm_foundry/tool/recover_hf_uploads.sh index 6671a7e..56a33d5 100755 --- a/lm_foundry/tool/recover_hf_uploads.sh +++ b/lm_foundry/tool/recover_hf_uploads.sh @@ -19,7 +19,15 @@ set -euo pipefail -HF_TOKEN_VALUE="$(ssh mac '/Users/ghost/core/secret/bin/secret get HF_TOKEN' 2>/dev/null)" +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS_DIR="${HEXA_RUNS_DIR:-$HOME/runs}" +export HEXA_RUNS_DIR="$RUNS_DIR" + +# Portable HF-token fetch: override $HF_TOKEN_CMD wholesale, or just point +# $HF_TOKEN_HOST at your ssh host (the `secret` CLI is resolved from PATH there). +HF_TOKEN_HOST="${HF_TOKEN_HOST:-mac}" +HF_TOKEN_CMD="${HF_TOKEN_CMD:-ssh $HF_TOKEN_HOST secret get HF_TOKEN}" +HF_TOKEN_VALUE="$($HF_TOKEN_CMD 2>/dev/null)" export HUGGING_FACE_HUB_TOKEN="$HF_TOKEN_VALUE" # verify token @@ -34,14 +42,14 @@ echo "whoami: $(echo "$WHOAMI" | python3 -c 'import json,sys; print(json.load(sy mkdir -p /tmp/r6_f16 /tmp/r6_q5 /tmp/r7_f16 /tmp/r7_q5 # r6: files may have been moved during earlier session โ€” relink if available -[ -f /home/summer/runs/hexa-forge-code-3b-v0.2.0-r6.f16.gguf ] && \ - mv /home/summer/runs/hexa-forge-code-3b-v0.2.0-r6.f16.gguf /tmp/r6_f16/ 2>/dev/null || true -[ -f /home/summer/runs/hexa-forge-code-3b-v0.2.0-r6.Q5_K_M.gguf ] && \ - mv /home/summer/runs/hexa-forge-code-3b-v0.2.0-r6.Q5_K_M.gguf /tmp/r6_q5/ 2>/dev/null || true +[ -f "$RUNS_DIR/hexa-forge-code-3b-v0.2.0-r6.f16.gguf" ] && \ + mv "$RUNS_DIR/hexa-forge-code-3b-v0.2.0-r6.f16.gguf" /tmp/r6_f16/ 2>/dev/null || true +[ -f "$RUNS_DIR/hexa-forge-code-3b-v0.2.0-r6.Q5_K_M.gguf" ] && \ + mv "$RUNS_DIR/hexa-forge-code-3b-v0.2.0-r6.Q5_K_M.gguf" /tmp/r6_q5/ 2>/dev/null || true # r7: copy from canonical home -cp /home/summer/runs/hexa-forge-code-3b-v0.2.0-r7.f16.gguf /tmp/r7_f16/ 2>/dev/null || true -cp /home/summer/runs/hexa-forge-code-3b-v0.2.0-r7.Q5_K_M.gguf /tmp/r7_q5/ 2>/dev/null || true +cp "$RUNS_DIR/hexa-forge-code-3b-v0.2.0-r7.f16.gguf" /tmp/r7_f16/ 2>/dev/null || true +cp "$RUNS_DIR/hexa-forge-code-3b-v0.2.0-r7.Q5_K_M.gguf" /tmp/r7_q5/ 2>/dev/null || true # README templates for round in r6 r7; do @@ -117,10 +125,12 @@ for repo_id, folder, repo_type in UPLOADS: commit_message="GGUF export โ€” recovery upload after token refresh") print(f" upload: {r}") -# Bench results from local runs/ (r7-strict) +# Bench results from local runs/ (r7-strict); $HEXA_RUNS_DIR (set by the shell +# wrapper) overrides, else ~/runs. +_RUNS = os.environ.get("HEXA_RUNS_DIR") or os.path.join(os.path.expanduser("~"), "runs") BENCH = [ - ("/home/summer/runs/hexa-eval-r7", "hexa-eval-r7-strict"), - ("/home/summer/runs/five-nl-r7", "five-nl-r7-strict"), + (os.path.join(_RUNS, "hexa-eval-r7"), "hexa-eval-r7-strict"), + (os.path.join(_RUNS, "five-nl-r7"), "five-nl-r7-strict"), ] for src, sub in BENCH: if not os.path.exists(src): diff --git a/lm_foundry/tool/runpod_launch_7b_sft.sh b/lm_foundry/tool/runpod_launch_7b_sft.sh index 7590a21..4f41b18 100644 --- a/lm_foundry/tool/runpod_launch_7b_sft.sh +++ b/lm_foundry/tool/runpod_launch_7b_sft.sh @@ -17,7 +17,7 @@ # PREREQS (the operator's machine): # - runpodctl installed + logged in (`runpodctl config --apiKey ...`) # - ~/.runpod/ssh/ present (the key referenced in anima/config/runpod.json) -# - HF token retrievable: `ssh mac /Users/ghost/core/secret/bin/secret get HF_TOKEN` +# - HF token retrievable via $HF_TOKEN_CMD (default: `ssh $HF_TOKEN_HOST secret get HF_TOKEN`) # - the hexa-forge repo reachable (this script's repo) # # WHAT IT DOES (encodes LEARNING_PROGRAMMING.md ยง6 RunPod rules): @@ -54,7 +54,10 @@ esac; done IMAGE="runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04" GPU="NVIDIA H100 SXM 80GB" -HF_TOKEN_CMD='ssh mac /Users/ghost/core/secret/bin/secret get HF_TOKEN' +# Portable HF-token fetch: override $HF_TOKEN_CMD wholesale, or just point +# $HF_TOKEN_HOST at your ssh host (the `secret` CLI is resolved from PATH there). +HF_TOKEN_HOST="${HF_TOKEN_HOST:-mac}" +HF_TOKEN_CMD="${HF_TOKEN_CMD:-ssh $HF_TOKEN_HOST secret get HF_TOKEN}" echo "=== runpod_launch_7b_sft.sh โ€” v0.3.0 Lever 1 (+3) ===" echo " base model : Qwen/Qwen2.5-Coder-7B" diff --git a/lm_foundry/tool/score_with_adapter.py b/lm_foundry/tool/score_with_adapter.py index 0efc5c9..cf40095 100755 --- a/lm_foundry/tool/score_with_adapter.py +++ b/lm_foundry/tool/score_with_adapter.py @@ -7,7 +7,7 @@ USAGE python3 tool/score_with_adapter.py \\ --base Qwen/Qwen2.5-Coder-3B \\ - --adapter /home/summer/runs/sft-lora-r16-v1 \\ + --adapter ~/runs/sft-lora-r16-v1 \\ --manifest eval/hexa-eval/manifest.jsonl \\ --output runs/hexa-eval-mk0/qwen3b-lora-r16-v1/ """ diff --git a/lm_foundry/tool/synth_apple_sft.py b/lm_foundry/tool/synth_apple_sft.py index 11697b5..fd75090 100755 --- a/lm_foundry/tool/synth_apple_sft.py +++ b/lm_foundry/tool/synth_apple_sft.py @@ -15,7 +15,7 @@ - Common iOS/macOS patterns (MVVM, dependency injection) - Refusal still respected โ€” only code-adjacent prompts accepted -OUT: /home/summer/runs/sft-apple/apple_pairs.jsonl +OUT: $HEXA_RUNS_DIR/sft-apple/apple_pairs.jsonl (default ~/runs/...) """ from __future__ import annotations import os as _os @@ -27,7 +27,9 @@ from pathlib import Path random.seed(42) -OUT = Path("/home/summer/runs/sft-apple/apple_pairs.jsonl") +# Portable runs root: $HEXA_RUNS_DIR overrides, else ~/runs. +RUNS = Path(_os.environ.get("HEXA_RUNS_DIR", Path.home() / "runs")) +OUT = RUNS / "sft-apple" / "apple_pairs.jsonl" def fmt(prompt, completion): diff --git a/tests/conftest.py b/tests/conftest.py index f433d7f..8962a9f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,7 +2,7 @@ hexa-codex pytest configuration. Most checks are auto-runnable (Python stdlib only); a few are tagged -`hexa` because they require the hexa-lang runtime (`/Users/ghost/.hx/bin/hexa`). +`hexa` because they require the hexa-lang runtime (`hexa` on PATH / ~/.hx/bin/hexa). """ from __future__ import annotations diff --git a/tests/test_install_hexa.py b/tests/test_install_hexa.py index 72d8aea..e669392 100644 --- a/tests/test_install_hexa.py +++ b/tests/test_install_hexa.py @@ -1,5 +1,6 @@ """ -install.hexa runtime test โ€” requires hexa-lang VM at /Users/ghost/.hx/bin/hexa. +install.hexa runtime test โ€” requires the hexa-lang VM (`hexa` on PATH, or +$HEXA_BIN, or ~/.hx/bin/hexa). """ from __future__ import annotations @@ -12,16 +13,19 @@ ROOT = Path(__file__).resolve().parents[1] +# Portable fallback hexa-lang VM path: $HEXA_BIN overrides, else ~/.hx/bin/hexa. +_HEXA_FALLBACK = Path(os.environ.get("HEXA_BIN", Path.home() / ".hx" / "bin" / "hexa")) + def _have_hexa() -> bool: - return shutil.which("hexa") is not None or Path("/Users/ghost/.hx/bin/hexa").exists() + return shutil.which("hexa") is not None or _HEXA_FALLBACK.exists() @pytest.mark.hexa def test_install_hexa_runs_clean(): if not _have_hexa(): pytest.skip("hexa-lang runtime not available") - hexa_bin = shutil.which("hexa") or "/Users/ghost/.hx/bin/hexa" + hexa_bin = shutil.which("hexa") or str(_HEXA_FALLBACK) env = os.environ.copy() env.update({ "HX_PKG_DIR": str(ROOT), diff --git a/verify/numerics_bitnet_bt77_n6_lattice.hexa b/verify/numerics_bitnet_bt77_n6_lattice.hexa index 10b3052..d388fa3 100644 --- a/verify/numerics_bitnet_bt77_n6_lattice.hexa +++ b/verify/numerics_bitnet_bt77_n6_lattice.hexa @@ -33,7 +33,7 @@ // Architecture flags (3): rms_norm_eps_neg_log10 ยท initializer_range_x100 ยท // tie_word_embeddings_bool // -// THE n=6 LATTICE ATOM SET (per /Users/ghost/core/hexa-lang/n6/atlas.n6 base +// THE n=6 LATTICE ATOM SET (per the hexa-lang n6/atlas.n6 base // definitions @P sigma/phi/tau/sopfr/J2/mu/M3 โ€” atlas.n6 lines 1-40): // atomic: n=6, phi=2, tau=4, sigma=12, sopfr=5, J2=24, mu=1, M3=7 // derived: sigma-phi=10, sigma-tau=8, n_over_phi=3, n_minus_phi=4,