]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml: `gguf_init_from_callback` and `gguf_init_from_buffer` (#22341)
authorGilad S. <redacted>
Mon, 25 May 2026 09:33:29 +0000 (11:33 +0200)
committerGitHub <redacted>
Mon, 25 May 2026 09:33:29 +0000 (11:33 +0200)
commit66efd13375bb0dfb28730d8c4b7d5c57cfd2c22d
treed0440e192be4d3c6b2ac6fa0bd6ecb048cd4f035
parent6c4cbdc70b83ac054106e9de3ebc2ecaa82c4b1f
ggml: `gguf_init_from_callback` and `gguf_init_from_buffer` (#22341)

* ggml: implement `gguf_init_from_buffer`

* test: `gguf_init_from_buffer`

* fix: memory breakdown for a model loaded with `no_alloc` from a file is consistent with being loaded from a buffer

* fix: use `GGML_UNUSED`

Co-authored-by: Copilot <redacted>
* fix: remove `total_size` from `gguf_reader`

* fix: file offset calculation, rename `offset` to `data_offset`

Co-authored-by: Copilot <redacted>
* refactor: extract model loader bug fixes to another PR

* feat: add `gguf_init_from_callback`

* fix: always require a max expected size

* fix: change `gguf_reader_callback_t`'s `output` type to `void *`, change `max_expected_size` and offsets to `uint64_t`

* fix: harden against offset overflow in buffer read

* fix: remove seek behavior from the callback

* feat: `max_chunk_read == 0` means `SIZE_MAX`

* fix: seeking in a gguf file with no tensors

---------

Co-authored-by: Copilot <redacted>
ggml/include/gguf.h
ggml/src/gguf.cpp
tests/test-gguf.cpp