]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
llama : fix segfault from unknown model arch name (#5820)
authorcompilade <redacted>
Sat, 2 Mar 2024 13:42:56 +0000 (08:42 -0500)
committerGitHub <redacted>
Sat, 2 Mar 2024 13:42:56 +0000 (15:42 +0200)
commit802da0091ba646ecf02e1a8fae2da0b8e76409bd
treeeab65e664dc826d4862237a302e535a12220c788
parent715641391dda1ff9762dc5d99d9a30acce99f2c6
llama : fix segfault from unknown model arch name (#5820)

* llama : fix segfault from unknown model arch name

* llama : make all LLM maps const

This also requires using `std::map::at` instead of its `operator[]`
which does not exist for const maps.

* llama : name LLM_ARCH_UNKNOWN to "(unknown)"

This avoids errors from `std::map::at` when
getting the general name of the model architecture.
Using "(unknown)" instead of an empty string as per suggestion
https://github.com/ggerganov/llama.cpp/pull/5820#issuecomment-1973735284

* llama : remove redundant inner const for LLM_TENSOR_NAMES

The extra const won't do anything here as const maps
return const references to values.

Co-authored-by: Jared Van Bortel <redacted>
* llama : remove redundant nullptr check in llm_arch_from_string

Since LLM_ARCH_NAMES is a const map, no spurious elements
with a NULL name are inserted anymore, so this check is dead code.

---------

Co-authored-by: Jared Van Bortel <redacted>
llama.cpp