Skip to content

Commit aa50af2

Browse files
committed
fix: don't crash on unsupported model architecture
1 parent 3fc0363 commit aa50af2

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

llama/patches/PR-22742.diff

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
2+
index 9a5802e3242..c14256389d8 100644
3+
--- a/src/llama-model.cpp
4+
+++ b/src/llama-model.cpp
5+
@@ -287,5 +287,5 @@ static llama_model * llama_model_mapping(llm_arch arch, const llama_model_params
6+
default:
7+
- GGML_ABORT("unimplemented model class");
8+
+ throw std::runtime_error(std::string("unsupported model architecture: ") + llm_arch_name(arch));
9+
}
10+
11+
}

src/bindings/utils/applyLlamaCppRepoPatches.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ const patches: RepoPatch[] = [{
5151

5252
return false;
5353
}
54+
}, {
55+
// https://github.com/ggml-org/llama.cpp/pull/22742
56+
filename: "PR-22742.diff",
57+
title: "model: don't crash on unsupported architecture",
58+
async canSkip(repoPath) {
59+
const llamaModel = await fs.readFile(path.join(repoPath, "src", "llama-model.cpp"), "utf8");
60+
return !llamaModel.includes('GGML_ABORT("unimplemented model class");');
61+
}
5462
}];
5563

5664
export function hasLlamaCppRepoPatchesToApply() {

0 commit comments

Comments
 (0)