Files
NowChessSystems/modules/official-bots/python/selfplay.sh
T
Janis Eccarius 1c80abdb8a
Build & Test (NowChessSystems) TeamCity build finished
feat(official-bots): standalone self-play + one-shot dataset builder for NNUE training
Add an easy local data pipeline feeding GPU training on Colab.

- SelfPlayMain: standalone NNUEBot self-play (no microservices) writing FENs
  for labeling; randomised openings for game diversity, sequential due to the
  shared EvaluationNNUE accumulator. Exposed via the `selfPlay` Gradle task and
  selfplay.sh.
- NNUEBot: optional fixedMoveTimeMs so self-play runs fast (default unchanged).
- NbaiLoader: honor `-Dnnue.weights=<path>` to load weights from a file before
  falling back to the bundled resource.
- build_dataset.py / dataset.sh: one command builds the entire dataset
  (Lichess eval-DB backbone + self-play + tactical + random filler), dedups,
  balances the eval histogram, writes append-only zstd shards + manifest, and
  rclone-pushes to Drive.
- train.py: NNUEDataset reads a directory of .jsonl.zst shards (streaming) in
  addition to a single file.
- NNUETraining.ipynb: clone to ephemeral /content, sync shards from Drive
  (cache-aware), train on the shards dir; removed Colab generation/upload steps.
- Concept + implementation plan docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 22:04:22 +02:00

24 lines
671 B
Bash

#!/usr/bin/env bash
# Standalone bot self-play -> FENs for labeling. No microservices.
#
# ./selfplay.sh # 500 games with the bundled net
# ./selfplay.sh 2000 # more games
# ./selfplay.sh 2000 path.nbai # play with a specific net
set -euo pipefail
GAMES="${1:-500}"
WEIGHTS="${2:-}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
OUT="$SCRIPT_DIR/data/selfplay.txt"
cd "$REPO_ROOT"
SP_ARGS="--games $GAMES --out $OUT"
if [[ -n "$WEIGHTS" ]]; then
SP_ARGS="$SP_ARGS --weights $WEIGHTS"
fi
./gradlew -q :modules:official-bots:selfPlay -PspArgs="$SP_ARGS"
echo "Self-play FENs -> $OUT"