8000 Keep dry reads off source weights by GroveMinting · Pull Request #7 · volotat/mini-AGI · GitHub
[go: up one dir, main page]

Skip to content

Keep dry reads off source weights - #7

Open
GroveMinting wants to merge 1 commit into
volotat:mainfrom
GroveMinting:fix/dry-read-immutable
Open

GroveMinting wants to merge 1 commit into
volotat:mainfrom
GroveMinting:fix/dry-read-immutable

Conversation

@GroveMinting
Copy link
Copy Markdown

Fixes #6.

What

  • Route dirty expert writeback into a temporary overlay during read without --save.
  • Read unchanged experts from the source checkpoint and prefer overlay copies after eviction.
  • Build a fresh dry-run model entirely in temporary storage.
  • Clean temporary state on normal completion and exceptions.
  • Prevent overlay deletion from falling through to source files.
  • Reject attempts to checkpoint an overlay rather than creating a mixed save.
  • Document the dry-read storage behavior.

Why

A dry read still trains in memory. Previously, when working-set churn overflowed ram_cache, dirty experts were written directly into weights/ even though the trunk, routers, optimizer bundle, and manifest were not saved. That could leave a hybrid checkpoint. Simply opening the pool read-only is not sufficient because an evicted expert would lose its in-session update.

Verification

python -m unittest discover -s tests -v

Four CPU tests pass. They cover:

  • dirty expert weights and Adam moments surviving eviction/reload;
  • byte content and inode metadata of a read-only source remaining unchanged;
  • overlay deletion and checkpoint guards;
  • the real train.py read command against an existing model;
  • fresh dry models existing only for the command lifetime.

Also verified with compileall and git diff --check.

10xCrazyHorse added a commit to yaaa-cool/mini-AGI that referenced this pull request Oct 3, 2026
A read without --save opened the paged pool writable, so dirty experts
evicted from a full RAM cache were written into the source weights
directory while the trunk, routers, optimiser and manifest were not -
a hybrid checkpoint. minagi/dryread.py redirects the pool's expert
writes to a temporary directory beside the weights; written experts
are read back from there, everything else from the untouched source.
cmd_read installs it with a three-line hook when --save is absent.

Approach follows upstream PR volotat#7 (sparse overlay) with fewer upstream
lines touched. Test: tests/test_bug6_dry_read.py (CPU).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dry reads can write expert updates into the source checkpoint

1 participant

0