Skip to content

Commit a3a2a06

Browse files
JohannesGaesslerggerganov
authored andcommitted
gguf-test: tensor data comparison
1 parent 7000623 commit a3a2a06

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ggml/src/gguf.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,10 @@ struct gguf_context * gguf_init_from_file_impl(FILE * file, struct gguf_init_par
648648

649649
ok = ok && data != nullptr;
650650

651+
if (ok) {
652+
ggml_set_name(data, "GGUF tensor data binary blob");
653+
}
654+
651655
// read the binary blob with the tensor data
652656
ok = ok && gr.read(data->data, ctx->size);
653657

tests/test-gguf.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,12 @@ static bool same_tensor_data(const struct ggml_context * orig, const struct ggml
10311031

10321032
struct ggml_tensor * t_orig = ggml_get_first_tensor(orig);
10331033
struct ggml_tensor * t_read = ggml_get_first_tensor(read);
1034+
1035+
if (std::string(t_read->name) != "GGUF tensor data binary blob") {
1036+
return false;
1037+
}
1038+
t_read = ggml_get_next_tensor(read, t_read);
1039+
10341040
while (t_orig) {
10351041
if (!t_read) {
10361042
ok = false;

0 commit comments

Comments
 (0)