Skip to content

Commit 5886f4f

Browse files
examples(gguf): GGUF example outputs (ggml-org#17025)
* feat(llama-gguf): Print out the tensor type in llama-gguf r Branch: Mamba2Perf Signed-off-by: Gabe Goodhart <[email protected]> * feat(off-topic): print the number of elements in tensors with llama-gguf Branch: Mamba2SSD Signed-off-by: Gabe Goodhart <[email protected]> * style: valign Branch: GGUFToolOutputs Signed-off-by: Gabe Goodhart <[email protected]> * Update examples/gguf/gguf.cpp --------- Signed-off-by: Gabe Goodhart <[email protected]> Co-authored-by: Georgi Gerganov <[email protected]>
1 parent 92bb84f commit 5886f4f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/gguf/gguf.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,13 @@ static bool gguf_ex_read_1(const std::string & fname, bool check_data) {
184184
const char * name = gguf_get_tensor_name (ctx, i);
185185
const size_t size = gguf_get_tensor_size (ctx, i);
186186
const size_t offset = gguf_get_tensor_offset(ctx, i);
187+
const auto type = gguf_get_tensor_type (ctx, i);
187188

188-
printf("%s: tensor[%d]: name = %s, size = %zu, offset = %zu\n", __func__, i, name, size, offset);
189+
const char * type_name = ggml_type_name(type);
190+
const size_t type_size = ggml_type_size(type);
191+
const size_t n_elements = size / type_size;
192+
193+
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);
189194
}
190195
}
191196

0 commit comments

Comments
 (0)