chore: rename libs→common_libs, all bot dirs to _garage suffix, fix all path refs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,3 +21,6 @@ __pycache__/
|
||||
.envrc
|
||||
devbox.json
|
||||
devbox.lock
|
||||
|
||||
# Git worktrees
|
||||
worktrees/
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--path:"../libs"
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
||||
--path:"../common_libs"
|
||||
@@ -7,6 +7,6 @@ bin = @["PPO_Bot"]
|
||||
|
||||
# Dependencies
|
||||
requires "nim >= 2.0.0"
|
||||
# tankroyale_botapi is vendored in-tree (libs/tankroyale_botapi) and wired via
|
||||
# tankroyale_botapi is vendored in-tree (common_libs/tankroyale_botapi) and wired via
|
||||
# config.nims --path; no nimble dependency so builds never touch ~/.nimble/pkgs2.
|
||||
requires "arraymancer >= 0.7.0"
|
||||
@@ -6,8 +6,8 @@ switch("threads", "on")
|
||||
when withDir(thisDir(), system.fileExists("nimble.paths")):
|
||||
include "nimble.paths"
|
||||
# end Nimble config
|
||||
# Use the repo-vendored Tank Royale bot API (libs/) instead of the nimble pkg.
|
||||
# Use the repo-vendored Tank Royale bot API (common_libs/) instead of the nimble pkg.
|
||||
# The pkg copy lived in ~/.nimble/pkgs2 and was patched ad-hoc; vendoring makes
|
||||
# the build self-contained and keeps the cross-thread Channel fix in-tree.
|
||||
# Must come AFTER the nimble.paths include: later --path wins the import search.
|
||||
switch("path", thisDir() & "/../libs/tankroyale_botapi")
|
||||
switch("path", thisDir() & "/../common_libs/tankroyale_botapi")
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
## diag_ppo_fullbuffer.nim — run ppoUpdate on a FULL 8192-transition buffer.
|
||||
## Verifies whether the round-10 death (first ppoUpdate at buffer capacity)
|
||||
## is a real crash in ppoUpdate or purely the saveAdamStates empty-shape bug.
|
||||
|
||||
import std/[math, random]
|
||||
import arraymancer
|
||||
import "../network"
|
||||
import "../training"
|
||||
|
||||
var ac = initActorCritic()
|
||||
var adam: ACAdamStates # uninitialised → ppoUpdate must reinit (fresh-process path)
|
||||
var buf = initTrajectoryBuffer()
|
||||
|
||||
randomize(1)
|
||||
while buf.len < MAX_TRANSITIONS:
|
||||
var t: Transition
|
||||
for i in 0..<STATE_DIM: t.state[i] = rand(1.0'f32) - 0.5'f32
|
||||
for i in 0..<ACTION_DIM: t.action[i] = rand(1.0'f32) - 0.5'f32
|
||||
t.logProb = rand(1.0'f32) - 1.0'f32
|
||||
t.reward = rand(0.02'f32) - 0.01'f32
|
||||
t.value = rand(0.1'f32)
|
||||
t.done = buf.len mod 300 == 299
|
||||
buf.add(t)
|
||||
|
||||
echo "buffer.len = ", buf.len, " (MAX=", MAX_TRANSITIONS, ")"
|
||||
var ac2 = ac
|
||||
var adam2: ACAdamStates
|
||||
try:
|
||||
let m = ppoUpdate(ac2, buf, lastValue = 0.0'f32, adamStates = adam2)
|
||||
echo "ppoUpdate OK: aLoss=", m.actorLoss, " vLoss=", m.valueLoss, " gNorm=", m.gradNorm
|
||||
except CatchableError as e:
|
||||
echo "CAUGHT CatchableError: ", e.msg
|
||||
echo getStackTrace(e)
|
||||
except Defect as e:
|
||||
echo "CAUGHT Defect: ", e.msg
|
||||
echo getStackTrace(e)
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
## diag_savecheckpoint.nim — reproduce the startup+saveCheckpoint path that
|
||||
## crashes with `io_npy.nim(143, 3) `0 < t.shape.len`` under the boot server.
|
||||
## Run: nim c -d:release tests/diag_savecheckpoint.nim && ./tests/diag_savecheckpoint
|
||||
|
||||
import std/[os]
|
||||
import arraymancer
|
||||
import "../network"
|
||||
import "../training"
|
||||
import "../weights"
|
||||
|
||||
const weightsRoot = currentSourcePath().parentDir.parentDir / "weights"
|
||||
|
||||
var ac = initActorCritic()
|
||||
var adam: ACAdamStates
|
||||
|
||||
let loadResult = loadBestAvailable(ac, adam, weightsRoot)
|
||||
echo "loaded=", loadResult.loaded, " roundNum=", loadResult.roundNum
|
||||
echo "adam.initialized=", adam.initialized
|
||||
echo "adam.aw1.m.shape=", adam.aw1.m.shape, " aw1.v.shape=", adam.aw1.v.shape
|
||||
echo "adam.logStd.m.shape=", adam.logStd.m.shape
|
||||
echo "adam.aw1.t=", adam.aw1.t
|
||||
|
||||
try:
|
||||
saveCheckpoint(ac, adam, weightsRoot, 1)
|
||||
echo "saveCheckpoint OK"
|
||||
except CatchableError as e:
|
||||
echo "CAUGHT CatchableError: ", e.msg
|
||||
echo getStackTrace(e)
|
||||
except Defect as e:
|
||||
echo "CAUGHT Defect: ", e.msg
|
||||
echo getStackTrace(e)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user