Skip to content

Commit f50a09c

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

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
@@ -17245,6 +17245,14 @@ float * llama_get_embeddings_seq(struct llama_context * ctx, llama_seq_id seq_id
1724517245
return it->second.data();
1724617246
}
1724717247

17248+
const char * llama_model_name(const struct llama_model * model) {
17249+
return model->name.c_str();
17250+
}
17251+
17252+
const char * llama_model_arch(const struct llama_model * model) {
17253+
return LLM_ARCH_NAMES.at(model->arch);
17254+
}
17255+
1724817256
const char * llama_token_get_text(const struct llama_model * model, llama_token token) {
1724917257
GGML_ASSERT(model->vocab.type != LLAMA_VOCAB_TYPE_NONE);
1725017258
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
@@ -797,6 +797,12 @@ extern "C" {
797797
// shape: [n_embd] (1-dimensional)
798798
LLAMA_API float * llama_get_embeddings_seq(struct llama_context * ctx, llama_seq_id seq_id);
799799

800+
//
801+
// Model Info
802+
//
803+
LLAMA_API const char * llama_model_name(const struct llama_model * model);
804+
LLAMA_API const char * llama_model_arch(const struct llama_model * model);
805+
800806
//
801807
// Vocab
802808
//

0 commit comments

Comments
 (0)