Build the training runner tool #34
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #29
Blocked by: #30, #32
Question
Build
tools/training_runner/— a Java + shell tool that runs PPO_Bot against a chosen opponent for a large number of rounds with crash recovery.Requirements:
tools/battle_runner/(keep that for debugging)Depends on: structured output format decision, hyperparam delivery decision.
Built:
tools/training_runner/What was built
tools/training_runner/RunTraining.java— Java battle runner that accepts[opponent] [rounds]CLI args (also via env varsTRAINING_OPPONENT/TRAINING_ROUNDS). Runs one round at a time in a loop, appending a{"type":"game",...}JSON line toPPOB_LOG_FILEafter each round with: round number, ticks, score, win/loss, opponent name.tools/training_runner/run.sh— Shell wrapper that:nimble build -d:release)RunTraining.javaweights/round_counter.txtto compute remaining rounds, restarts Java runner on crash, exits when all rounds donePPO_Bot/PPO_Bot.nim— Extended with:PPOB_*env var reading at startup (decision #30):PPOB_LR,PPOB_CLIP_EPSILON,PPOB_ENTROPY_COEFF,PPOB_VALUE_LOSS_COEFF,PPOB_MAX_GRAD_NORM,PPOB_GAMMA,PPOB_LAM,PPOB_EPOCHS,PPOB_MINI_BATCH_SIZE— all optional, defaults match existing codePPOB_LOG_FILEenv var: if set, PPO_Bot appends two JSON line types per round:{"type":"round", "round":N, "ticks":N, "avgReward":f, "score":N, "ts":N}— game outcome at round end{"type":"train", "round":N, "actorLoss":f, "valueLoss":f, "gradNorm":f, "ts":N, "lr":f, ...hyperparams}— training health when background thread finishesPPO_Bot/training.nim—ppoUpdatenow acceptsgammaandlamparams (forwarded from env vars viaTrainingArgs).Log format
Three JSON line types in
training_log.jsonl(also written by Java runner):{"type":"game", ...}— from Java runner (game-engine outcome){"type":"round", ...}— from PPO_Bot (reward stats){"type":"train", ...}— from PPO_Bot (gradient/loss health + hyperparam snapshot)Reader correlates by
roundfield. No derived stats — reader computes those (decision #32).Crash recovery
PPO_Bot persists round counter to
weights/round_counter.txt(decision #35). Shell wrapper reads it on each restart to compute remaining rounds. No work is lost.Usage