From: Gabe Goodhart Date: Wed, 5 Nov 2025 17:58:16 +0000 (-0700) Subject: examples(gguf): GGUF example outputs (#17025) X-Git-Tag: upstream/0.0.7011~51 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=5886f4f545591dafbbd9d6117a46d7399ce13bfa;p=pkg%2Fggml%2Fsources%2Fllama.cpp examples(gguf): GGUF example outputs (#17025) * feat(llama-gguf): Print out the tensor type in llama-gguf r Branch: Mamba2Perf Signed-off-by: Gabe Goodhart * feat(off-topic): print the number of elements in tensors with llama-gguf Branch: Mamba2SSD Signed-off-by: Gabe Goodhart * style: valign Branch: GGUFToolOutputs Signed-off-by: Gabe Goodhart * Update examples/gguf/gguf.cpp --------- Signed-off-by: Gabe Goodhart Co-authored-by: Georgi Gerganov --- diff --git a/examples/gguf/gguf.cpp b/examples/gguf/gguf.cpp index f31989c8..499cfacc 100644 --- a/examples/gguf/gguf.cpp +++ b/examples/gguf/gguf.cpp @@ -184,8 +184,13 @@ static bool gguf_ex_read_1(const std::string & fname, bool check_data) { const char * name = gguf_get_tensor_name (ctx, i); const size_t size = gguf_get_tensor_size (ctx, i); const size_t offset = gguf_get_tensor_offset(ctx, i); + const auto type = gguf_get_tensor_type (ctx, i); - printf("%s: tensor[%d]: name = %s, size = %zu, offset = %zu\n", __func__, i, name, size, offset); + const char * type_name = ggml_type_name(type); + const size_t type_size = ggml_type_size(type); + const size_t n_elements = size / type_size; + + printf("%s: tensor[%d]: name = %s, size = %zu, offset = %zu, type = %s, n_elts = %zu\n", __func__, i, name, size, offset, type_name, n_elements); } }