Skip to content

Commit 816a7fc

Browse files
committed
llama : expose model name and architecture via API
Signed-off-by: Jared Van Bortel <[email protected]>
1 parent 2d3ce01 commit 816a7fc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

llama.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17461,6 +17461,14 @@ float * llama_get_embeddings_seq(struct llama_context * ctx, llama_seq_id seq_id
1746117461
return it->second.data();
1746217462
}
1746317463

17464+
const char * llama_model_name(const struct llama_model * model) {
17465+
return model->name.c_str();
17466+
}
17467+
17468+
const char * llama_model_arch(const struct llama_model * model) {
17469+
return LLM_ARCH_NAMES.at(model->arch);
17470+
}
17471+
1746417472
const char * llama_token_get_text(const struct llama_model * model, llama_token token) {
1746517473
GGML_ASSERT(model->vocab.type != LLAMA_VOCAB_TYPE_NONE);
1746617474
return model->vocab.id_to_token[token].text.c_str();

llama.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,12 @@ extern "C" {
804804
// shape: [n_embd] (1-dimensional)
805805
LLAMA_API float * llama_get_embeddings_seq(struct llama_context * ctx, llama_seq_id seq_id);
806806

807+
//
808+
// Model Info
809+
//
810+
LLAMA_API const char * llama_model_name(const struct llama_model * model);
811+
LLAMA_API const char * llama_model_arch(const struct llama_model * model);
812+
807813
//
808814
// Vocab
809815
//

0 commit comments

Comments
 (0)