| 886 | } |
| 887 | |
| 888 | int64_t gguf_find_key(const struct gguf_context * ctx, const char * key) { |
| 889 | // return -1 if key not found |
| 890 | int64_t keyfound = -1; |
| 891 | |
| 892 | const int64_t n_kv = gguf_get_n_kv(ctx); |
| 893 | |
| 894 | for (int64_t i = 0; i < n_kv; ++i) { |
| 895 | if (strcmp(key, gguf_get_key(ctx, i)) == 0) { |
| 896 | keyfound = i; |
| 897 | break; |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | return keyfound; |
| 902 | } |
| 903 | |
| 904 | const char * gguf_get_key(const struct gguf_context * ctx, int64_t key_id) { |
| 905 | GGML_ASSERT(key_id >= 0 && key_id < gguf_get_n_kv(ctx)); |
no test coverage detected