-
Notifications
You must be signed in to change notification settings - Fork 10.2k
dev notes
These are general free form note with pointers to good jumping to point to under stand the llama.cpp codebase.
(@<symbol>
is a vscode jump to symbol code for your convenience. Also making a feature request to vscode to be able to jump to file and symbol via <file>:@<symbol>
)
All of the gguf structure can be found in gguf.c
unless stated otherwise
GGUF Structure Of Interest | gguf.c reference | vscode search line |
---|---|---|
Overall File Structure | struct gguf_context |
@gguf_context |
File Header Structure | struct gguf_header |
@gguf_header |
Key Value Structure | struct gguf_kv |
@gguf_kv |
Tensor Info Structure | struct gguf_tensor_info |
@gguf_tensor_info |
Please use this as an index not as canonical reference. The purpose of this table is to allow you to quickly locate major elements of the gguf file standard.
Header Name | GGUF Elements Of Interest | c name | c type | vscode search line |
---|---|---|---|---|
GGUF Header | Magic | magic | uint8_t[4] |
gguf.c:@gguf_header
|
GGUF Header | Version | version | uint32_t |
gguf.c:@gguf_header
|
GGUF Header | Tensor Count | n_tensors | uint64_t |
gguf.c:@gguf_header
|
GGUF Header | Key Value Count | n_kv | uint64_t |
gguf.c:@gguf_header
|
GGUF Context | Key Value Linked List | kv | gguf_kv * |
gguf.c:@gguf_context
|
GGUF Context | Tensor Info Linked List | infos | gguf_tensor_info * |
gguf.c:@gguf_context
|
Key Value Entry | Key | gguf_kv.key | gguf_str |
gguf.c:@gguf_kv
|
Key Value Entry | Type | gguf_kv.type | gguf_type |
gguf.c:@gguf_kv
|
Key Value Entry | Type | gguf_kv.value | gguf_value |
gguf.c:@gguf_kv
|
Tensor Info Entry | Name | gguf_tensor_info.name | gguf_str |
gguf.c:@gguf_tensor_info
|
Tensor Info Entry | Tensor shape dimension count | gguf_tensor_info.n_dim | uint32_t |
gguf.c:@gguf_tensor_info
|
Tensor Info Entry | Tensor shape sizing array | gguf_tensor_info.ne | uint64_t[GGML_MAX_DIMS] |
gguf.c:@gguf_tensor_info
|
Tensor Info Entry | Tensor Encoding Scheme / Strategy | gguf_tensor_info.type | ggml_type |
gguf.c:@gguf_tensor_info
|
Tensor Info Entry | Offset from start of 'data' | gguf_tensor_info.offset | uint64_t |
gguf.c:@gguf_tensor_info
|
Also just note that these values are not actually part of gguf but is there for internal usage and is calculated during model loading. Aka it's for the writing/reading api.
Header Name | GGML Elements Of Interest | c name | c type | vscode search line |
---|---|---|---|---|
GGUF Context | Alignment | alignment | size_t |
gguf.c:@gguf_context
|
GGUF Context | Offset Of 'Data' From Beginning Of File | offset | size_t |
gguf.c:@gguf_context
|
GGUF Context | Size Of 'Data' In Bytes | size | size_t |
gguf.c:@gguf_context
|
Tensor Info Entry | Tensor memory mapped pointer location in computer | data | void * |
gguf.c:@gguf_tensor_info
|
Tensor Info Entry | Tensor memory mapped size of layer data in computer | size | size_t |
gguf.c:@gguf_tensor_info
|
There is this cpp example program that will write a test gguf write/read
Useful information for users that doesn't fit into Readme.
- Home
- Feature Matrix
- GGML Tips & Tricks
- Chat Templating
- Metadata Override
- HuggingFace Model Card Metadata Interoperability Consideration
These are information useful for Maintainers and Developers which does not fit into code comments
Click on a badge to jump to workflow. This is here as a useful general view of all the actions so that we may notice quicker if main branch automation is broken and where.