mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-12 14:22:11 -04:00
llama.cpp reports the same tensor-count error for unsupported model layouts and damaged GGUF files. Add a focused hint so operators can update the backend or verify the model without losing the upstream diagnostic. Assisted-by: Codex:gpt-5.6 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
25 lines
729 B
C++
25 lines
729 B
C++
// SPDX-License-Identifier: MIT
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace localai {
|
|
|
|
inline std::string model_load_error_with_hint(const std::string& error) {
|
|
const std::string mismatch = "wrong number of tensors; expected ";
|
|
const std::string got = ", got ";
|
|
const std::string::size_type mismatch_pos = error.find(mismatch);
|
|
if (mismatch_pos == std::string::npos ||
|
|
error.find(got, mismatch_pos + mismatch.size()) == std::string::npos) {
|
|
return error;
|
|
}
|
|
|
|
return error +
|
|
" Hint: the model may be incompatible with this llama.cpp backend "
|
|
"or the GGUF file may be corrupt. Try a newer compatible backend "
|
|
"and verify or re-download the model file.";
|
|
}
|
|
|
|
} // namespace localai
|