Skip to content

fix(strip_vision_weights): shrink metadata.total_size by dropped bytes - #121

Open
kuishou68 wants to merge 1 commit into
Edge0-AI:mainfrom
kuishou68:cocoon-fix-edge0
Open

kuishou68 wants to merge 1 commit into
Edge0-AI:mainfrom
kuishou68:cocoon-fix-edge0

Conversation

@kuishou68

Copy link
Copy Markdown

After stripping vision-tower tensors, the script removed the dropped
keys from model.safetensors.index.json but left metadata.total_size at
its pre-strip value, so the index reported more bytes than the shards
actually contain.

Accumulate the dropped tensor bytes across shards and subtract them
from metadata.total_size when the field is present.

Add a stdlib-only regression test that builds a synthetic shard +
index, runs the script, and checks the corrected total_size.

Fixes #18

After stripping vision-tower tensors, the script removed the dropped
keys from model.safetensors.index.json but left metadata.total_size at
its pre-strip value, so the index reported more bytes than the shards
actually contain.

Accumulate the dropped tensor bytes across shards and subtract them
from metadata.total_size when the field is present.

Add a stdlib-only regression test that builds a synthetic shard +
index, runs the script, and checks the corrected total_size.

Fixes Edge0-AI#18
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.

[Feature request] Non-macOS support

1 participant