Skip to content

fix(scripts): recompute metadata.total_size after stripping vision weights - #117

Open
agourakis82 wants to merge 2 commits into
Edge0-AI:mainfrom
agourakis82:fix/strip-vision-total-size
Open

agourakis82 wants to merge 2 commits into
Edge0-AI:mainfrom
agourakis82:fix/strip-vision-total-size

Conversation

@agourakis82

@agourakis82 agourakis82 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #104.

Stripping vision tensors leaves metadata.total_size at its original value. Track the tensor bytes removed across shards and subtract them from total_size when 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.

agourakis82 and others added 2 commits October 4, 2026 10:40
…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
agourakis82 force-pushed the fix/strip-vision-total-size branch from 869815d to 772bdcf Compare October 4, 2026 13:47
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.

scripts/strip_vision_weights.py leaves metadata.total_size at the pre-strip value

1 participant