summaryrefslogtreecommitdiff
path: root/src/eval_tune
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-15 16:28:55 -0700
committerScott Gasch <[email protected]>2026-10-15 16:28:55 -0700
commit3b5d3677bb14ae14728a1c4b221176bb83667d92 (patch)
tree499811ae2acab2a532a58c2911804c2cec27cb8d /src/eval_tune
parentc179ae5ad9f1a0efb68904033621705fd060aea4 (diff)
test_vs_head.sh: add NNUE_WEIGHTS to run an NNUE candidate vs HCE head
match_play.py's Engine passes identical engine_args to both sides, so there was no way to get an NNUE candidate playing against the classic- eval head_reference without patching match_play.py itself. Instead, when NNUE_WEIGHTS is set this wraps the candidate binary in a thin exec shim that always injects "--nnueweights $NNUE_WEIGHTS" -- works unmodified because Engine spawns the given path directly via Popen (no shell), so a shebang script in its place is indistinguishable from a real binary to it. HEAD is untouched, so it keeps running HCE. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/eval_tune')
-rwxr-xr-xsrc/eval_tune/test_vs_head.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/eval_tune/test_vs_head.sh b/src/eval_tune/test_vs_head.sh
index dbddf10..71b2282 100755
--- a/src/eval_tune/test_vs_head.sh
+++ b/src/eval_tune/test_vs_head.sh
@@ -62,6 +62,19 @@
# SPRT_ARGS="" TC_ARGS="--st 4 --odds 2" GAMES=1000 \
# test_vs_head.sh ../../head_reference/typhoon \
# ../../head_reference/typhoon timeodds
+#
+# NNUE_WEIGHTS: path to a weights file (as produced by annotate_pgns/
+# export_nnue_weights.py). When set, the CANDIDATE binary is wrapped
+# in a thin exec shim that always injects "--nnueweights $NNUE_WEIGHTS"
+# ahead of whatever args match_play.py's Engine class passes it --
+# that's the only change needed, since Engine spawns the given path
+# directly via Popen (no shell), so a shebang script in its place works
+# unmodified. HEAD is untouched, so it keeps running the classic HCE --
+# this is how you get an NNUE-candidate-vs-HCE-reference match without
+# patching match_play.py's Engine (which currently passes identical
+# engine_args to both sides):
+#
+# NNUE_WEIGHTS=/path/to/net.nnue test_vs_head.sh
set -e
@@ -102,6 +115,16 @@ else
cp -f ../typhoon ${CANDIDATE}
fi
+if [ -n "${NNUE_WEIGHTS:-}" ]; then
+ NNUE_WRAPPER=/tmp/typhoon/typhoon_match_play_candidate_nnue
+ cat > "$NNUE_WRAPPER" <<WRAPPER
+#!/usr/bin/env bash
+exec "$CANDIDATE" --nnueweights "$NNUE_WEIGHTS" "\$@"
+WRAPPER
+ chmod +x "$NNUE_WRAPPER"
+ CANDIDATE="$NNUE_WRAPPER"
+fi
+
python3 ./match_play.py \
${HEAD} \
${CANDIDATE} \