-
Notifications
You must be signed in to change notification settings - Fork 450
gguf: calculate tensor data offset #1076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
adding tensors offset within file. offsets stored in metadata are relative to this offset and it's absent in metadata. with this field it's possible to actually access layers in gguf. without of it - offsets shown are useless.
@drazdra happy to merge after:
|
does this look valid @ngxson @Vaibhavs10? |
@ngxson is this correct? |
sorry about errors, i don't know TS, in my case i just patched the ready file in dist with JS and used it as is. |
|
I changed the naming to int main(int argc, const char ** argv) {
struct ggml_context * ctx_meta = NULL;
struct gguf_init_params gguf_params = {
/*.no_alloc = */ true,
/*.ctx = */ &ctx_meta,
};
auto * ctx_gguf = gguf_init_from_file("/Users/ngxson/Downloads/llama-2-7b-chat.Q2_K.gguf", gguf_params);
printf("gguf_get_data_offset: %zu\n", gguf_get_data_offset(ctx_gguf));
return 0;
} Note sure why node test failed, I'll have a look later (I'm using a slow network) |
Should be ok now, matched the output from cpp code in my last comment. Pinging @mishig25 for an extra review. |
Co-authored-by: Julien Chaumond <julien@huggingface.co>
adding tensors offset within file. offsets stored in metadata are relative to this offset and it's absent in metadata. with this field it's possible to actually access layers in gguf. without of it - offsets shown are useless.