Skip to content

Commit

Permalink
llama : expose model name and architecture via API
Browse files Browse the repository at this point in the history
  • Loading branch information
cebtenzzre committed Sep 26, 2024
1 parent acc0c90 commit fce09ac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/llama.h
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,12 @@ extern "C" {
// shape: [n_embd] (1-dimensional)
LLAMA_API float * llama_get_embeddings_seq(struct llama_context * ctx, llama_seq_id seq_id);

//
// Model Info
//
LLAMA_API const char * llama_model_name(const struct llama_model * model);
LLAMA_API const char * llama_model_arch(const struct llama_model * model);

//
// Vocab
//
Expand Down
12 changes: 12 additions & 0 deletions src/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20922,6 +20922,18 @@ float * llama_get_embeddings_seq(struct llama_context * ctx, llama_seq_id seq_id
return it->second.data();
}

//
// Model Info
//

const char * llama_model_name(const struct llama_model * model) {
return model->name.c_str();
}

const char * llama_model_arch(const struct llama_model * model) {
return LLM_ARCH_NAMES.at(model->arch);
}

//
// vocab
//
Expand Down

0 comments on commit fce09ac

Please sign in to comment.