mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-27 20:04:35 +00:00
gguf : minor stuff
This commit is contained in:
parent
1da82c551f
commit
8083ae347a
@ -256,10 +256,9 @@ bool gguf_ex_read_0(const std::string & fname) {
|
|||||||
|
|
||||||
// find kv string
|
// find kv string
|
||||||
{
|
{
|
||||||
char findkey[32];
|
const char * findkey = "some.parameter.string";
|
||||||
sprintf(findkey, "some.parameter.string");
|
|
||||||
|
|
||||||
int keyidx = gguf_find_key(ctx, findkey);
|
const int keyidx = gguf_find_key(ctx, findkey);
|
||||||
if (keyidx == -1) {
|
if (keyidx == -1) {
|
||||||
fprintf(stdout, "%s: find key: %s not found.\n", __func__, findkey);
|
fprintf(stdout, "%s: find key: %s not found.\n", __func__, findkey);
|
||||||
} else {
|
} else {
|
||||||
@ -297,7 +296,7 @@ bool gguf_ex_read_1(const std::string & fname) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct gguf_context * ctx = gguf_init_from_file(fname.c_str(), params);
|
struct gguf_context * ctx = gguf_init_from_file(fname.c_str(), params);
|
||||||
|
|
||||||
fprintf(stdout, "%s: version: %d\n", __func__, gguf_get_version(ctx));
|
fprintf(stdout, "%s: version: %d\n", __func__, gguf_get_version(ctx));
|
||||||
fprintf(stdout, "%s: alignment: %zu\n", __func__, gguf_get_alignment(ctx));
|
fprintf(stdout, "%s: alignment: %zu\n", __func__, gguf_get_alignment(ctx));
|
||||||
fprintf(stdout, "%s: data offset: %zu\n", __func__, gguf_get_data_offset(ctx));
|
fprintf(stdout, "%s: data offset: %zu\n", __func__, gguf_get_data_offset(ctx));
|
||||||
@ -388,7 +387,7 @@ bool gguf_ex_read_2(const std::string & fname) {
|
|||||||
|
|
||||||
// print first 10 elements
|
// print first 10 elements
|
||||||
const float * data = (const float *) cur->data;
|
const float * data = (const float *) cur->data;
|
||||||
|
|
||||||
printf("%s data[:10] : ", name);
|
printf("%s data[:10] : ", name);
|
||||||
|
|
||||||
for (int j = 0; j < 10; ++j) {
|
for (int j = 0; j < 10; ++j) {
|
||||||
@ -402,7 +401,7 @@ fprintf(stdout, "%s: ctx_data size: %zu\n", __func__, ggml_get_mem_size(ctx_data
|
|||||||
|
|
||||||
ggml_free(ctx_data);
|
ggml_free(ctx_data);
|
||||||
gguf_free(ctx);
|
gguf_free(ctx);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
ggml.c
4
ggml.c
@ -19031,10 +19031,6 @@ const char * gguf_get_key(struct gguf_context * ctx, int i) {
|
|||||||
return ctx->header.kv[i].key.data;
|
return ctx->header.kv[i].key.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum gguf_type gguf_get_type(struct gguf_context * ctx, int i) {
|
|
||||||
return ctx->header.kv[i].type;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char * gguf_get_arr_str(struct gguf_context * ctx, int key_id, int i) {
|
const char * gguf_get_arr_str(struct gguf_context * ctx, int key_id, int i) {
|
||||||
struct gguf_kv * kv = &ctx->header.kv[key_id];
|
struct gguf_kv * kv = &ctx->header.kv[key_id];
|
||||||
struct gguf_str * str = &((struct gguf_str *) kv->value.arr.data)[i];
|
struct gguf_str * str = &((struct gguf_str *) kv->value.arr.data)[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user