]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
examples(gguf): GGUF example outputs (#17025)
authorGabe Goodhart <redacted>
Wed, 5 Nov 2025 17:58:16 +0000 (10:58 -0700)
committerGitHub <redacted>
Wed, 5 Nov 2025 17:58:16 +0000 (19:58 +0200)
* feat(llama-gguf): Print out the tensor type in llama-gguf r

Branch: Mamba2Perf

Signed-off-by: Gabe Goodhart <redacted>
* feat(off-topic): print the number of elements in tensors with llama-gguf

Branch: Mamba2SSD

Signed-off-by: Gabe Goodhart <redacted>
* style: valign

Branch: GGUFToolOutputs

Signed-off-by: Gabe Goodhart <redacted>
* Update examples/gguf/gguf.cpp

---------

Signed-off-by: Gabe Goodhart <redacted>
Co-authored-by: Georgi Gerganov <redacted>
examples/gguf/gguf.cpp

index f31989c8c55c6a5b6b2a7369e47bc48d4677d3ea..499cfacc92aa91aeb5141f9aaf43ce283c1bb060 100644 (file)
@@ -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);
         }
     }