Weight persistence module #46

Closed
opened 2026-08-20 23:28:35 +02:00 by SirStone · 1 comment
Owner

Parent

#37

What to build

Save and load all network tensors (actor, 2 critics, 2 target critics, alpha parameter, Adam optimizer states) as individual .npy tensors packed into a single .zip file via Nim's std/zipfiles.

Each tensor is a standard .npy inside the archive — individually inspectable by extracting. Atomic save: write to a temp file, then rename to the target path.

Checkpoint directory convention: weights/latest.zip for current state, periodic snapshots as weights/checkpoint_<N>.zip.

Acceptance criteria

  • save(path, networks) creates a valid .zip containing .npy entries for all tensors
  • load(path) → networks restores all tensors exactly (round-trip correctness)
  • File is a valid zip — can be extracted with standard tools and .npy files are readable by numpy
  • Atomic save: incomplete writes don't corrupt the checkpoint
  • test_weights.nim passes

Blocked by

  • #38 (SAC_LSTM_Bot: project scaffold)
  • #41 (LSTM network module)
## Parent #37 ## What to build Save and load all network tensors (actor, 2 critics, 2 target critics, alpha parameter, Adam optimizer states) as individual `.npy` tensors packed into a single `.zip` file via Nim's `std/zipfiles`. Each tensor is a standard `.npy` inside the archive — individually inspectable by extracting. Atomic save: write to a temp file, then rename to the target path. Checkpoint directory convention: `weights/latest.zip` for current state, periodic snapshots as `weights/checkpoint_<N>.zip`. ## Acceptance criteria - [ ] `save(path, networks)` creates a valid `.zip` containing `.npy` entries for all tensors - [ ] `load(path) → networks` restores all tensors exactly (round-trip correctness) - [ ] File is a valid zip — can be extracted with standard tools and `.npy` files are readable by numpy - [ ] Atomic save: incomplete writes don't corrupt the checkpoint - [ ] `test_weights.nim` passes ## Blocked by - #38 (SAC_LSTM_Bot: project scaffold) - #41 (LSTM network module)
SirStone added the ready-for-agent label 2026-08-20 23:28:35 +02:00
Author
Owner

Weight persistence module complete — zipped .npy via std/zipfiles, atomic save (temp+rename), checkpoint includes Adam states with optional load. 12/12 tests pass. Full suite 69+ tests all green. Code reviewed clean.

Weight persistence module complete — zipped .npy via std/zipfiles, atomic save (temp+rename), checkpoint includes Adam states with optional load. 12/12 tests pass. Full suite 69+ tests all green. Code reviewed clean.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SirStone/SirRoboGarage#46