Skip to content

Commit

Permalink
llama : fix segfault from unknown model name
Browse files Browse the repository at this point in the history
  • Loading branch information
compilade committed Mar 1, 2024
1 parent e743386 commit 34f5cfa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,16 @@ static std::map<llm_arch, std::map<llm_tensor, std::string>> LLM_TENSOR_NAMES =

static llm_arch llm_arch_from_string(const std::string & name) {
for (const auto & kv : LLM_ARCH_NAMES) { // NOLINT
if (kv.second == nullptr) {
// LLM_ARCH_UNKNOWN does not have a name,
// but is somehow still in the LLM_ARCH_NAMES map.
if (kv.first == LLM_ARCH_UNKNOWN) {
// skip string comparison
continue;
}
// known architectures should always have a name
GGML_ASSERT(false && "missing architecture in LLM_ARCH_NAMES");
}
if (kv.second == name) {
return kv.first;
}
Expand Down

0 comments on commit 34f5cfa

Please sign in to comment.