gguf : do not hardcode tensor names to read

This commit is contained in:
M. Yusuf Sarıgöz 2023-07-29 10:24:46 +03:00
parent 9475cdb7a3
commit 08dc8fd884

View File

@ -335,9 +335,9 @@ bool gguf_ex_read_1(const std::string & fname) {
for (int i = 0; i < n_tensors; ++i) {
fprintf(stdout, "%s: reading tensor %d data\n", __func__, i);
const std::string name = "tensor_" + to_string(i);
const char * name = gguf_get_tensor_name(ctx, i);
struct ggml_tensor * cur = ggml_get_tensor(ctx_data, name.c_str());
struct ggml_tensor * cur = ggml_get_tensor(ctx_data, name);
fprintf(stdout, "%s: tensor[%d]: n_dims = %d, name = %s, data = %p\n",
__func__, i, cur->n_dims, cur->name, cur->data);