b509195ee9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
1.0 KiB
Nim
31 lines
1.0 KiB
Nim
## 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) |