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
| #!/usr/bin/env python3 | |
| # Repack a split GGUF so one tensor (default: the qwen4exp engram table | |
| # per_layer_token_embd.weight) sits ALONE in the final shard, with no other tensors | |
| # sharing that file. Motivation: on Metal, llama.cpp wires the mmap'd regions that | |
| # back GPU tensors; a tensor interleaved with them in the same file gets wired along | |
| # for the ride (measured +24 GiB on Qwen3.8-Flash-Next). A file containing only | |
| # CPU-side tensors keeps its own mapping and stays pageable. | |
| # | |
| # Tensor bytes are copied verbatim (no requantization). Output layout for an N-file | |
| # input: shard 1 = byte-for-byte copy of input shard 1 (metadata-only; split.count and |