The previous _skip_gguf_value walked past discarded values with f.read(n), which allocates and immediately drops a Python bytes object. For weight GGUFs that carry tokenizer.ggml.tokens (~150K unicode strings) this wasted ~10 MB of allocation per cold call. Switch the discard path to f.seek(n, 1). The kernel never has to copy the bytes into userspace and Python never allocates. Truncation is now detected on the next read attempt rather than inline (an out-of-range seek on a regular file is legal and the next read returns short). Measured on real downloaded GGUFs (Qwen3.5-4B IQ2_XXS 1.52 GB, bartowski Qwen3.5-4B IQ2_M 1.70 GB, Qwen3.5-4B-MTP IQ2_M 1.94 GB): before: 142 ms cold per weight, ~11 MB read after: 90 ms cold per weight, ~4 MB read Mmproj reads are unaffected (no tokenizer to skip). Cached re-reads remain ~50 microseconds. All 161 in-tree backend tests + 85 isolated sandbox tests pass. |
||
|---|---|---|
| .. | ||
| datasets | ||
| hardware | ||
| inference | ||
| models | ||
| paths | ||
| .gitkeep | ||
| __init__.py | ||
| _studio_release_build.py | ||
| cache_cleanup.py | ||
| downsample.py | ||
| native_path_leases.py | ||
| studio_version.py | ||
| subprocess_compat.py | ||
| transformers_version.py | ||
| update_status.py | ||
| utils.py | ||
| wheel_utils.py | ||