fix(scripts): recompute metadata.total_size after stripping vision weights - #117
Open
agourakis82 wants to merge 2 commits into
Open
agourakis82 wants to merge 2 commits into
agourakis82 wants to merge 2 commits into
Conversation
…ights strip_vision_weights.py removed vision keys from weight_map but left metadata.total_size at its pre-strip value. Given an index with total_size=96 and 32 bytes of vision tensors, the index still reported 96 after stripping, so consumers trusting total_size over-report disk usage by the stripped volume (~0.9 GB on the real 35B checkpoint). Tracks the bytes actually dropped from each rewritten shard (already computed for the per-shard log line) and subtracts the running total from metadata.total_size once, after all shards are processed. This is equivalent to recomputing from the retained tensor offsets — untouched shards' bytes are unaffected by definition, so old_total - dropped equals the true new total. Fixes Edge0-AI#104. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
agourakis82
force-pushed
the
fix/strip-vision-total-size
branch
from
October 4, 2026 13:47
869815d to
772bdcf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #104.
Stripping vision tensors leaves
metadata.total_sizeat its original value. Track the tensor bytes removed across shards and subtract them fromtotal_sizewhen present; leave indexes without that field unchanged.Rebased onto the
python/layout. Tests cover multiple affected shards, an untouched shard, retained payloads, optional metadata, and backup behavior. Local default suite: 84 passed, 1 skipped, 4 slow tests deselected with MLX 0.30.4 and mlx-lm 0.31.0. The two size-regression tests fail on the unpatched base.Related: #121 addresses the same bug.