7bd7b02712
raw diffs can be applied using `git apply` but not with `git am`. git patches, e.g. through `git format-patch` are both apply-able and am-able
57 lines
1.8 KiB
Diff
57 lines
1.8 KiB
Diff
From e43bfd3f607a6dfcaba2d490d35f412a52e55e30 Mon Sep 17 00:00:00 2001
|
|
From: Michael Yang <mxyng@pm.me>
|
|
Date: Mon, 16 Sep 2024 15:53:12 -0700
|
|
Subject: [PATCH] 03-load_exception.diff
|
|
|
|
---
|
|
src/llama.cpp | 25 ++++++++++++++++---------
|
|
1 file changed, 16 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/src/llama.cpp b/src/llama.cpp
|
|
index 88355971..926bb71a 100644
|
|
--- a/src/llama.cpp
|
|
+++ b/src/llama.cpp
|
|
@@ -8635,7 +8635,7 @@ static int llama_model_load(const std::string & fname, llama_model & model, llam
|
|
}
|
|
} catch (const std::exception & err) {
|
|
LLAMA_LOG_ERROR("%s: error loading model: %s\n", __func__, err.what());
|
|
- return -1;
|
|
+ throw;
|
|
}
|
|
|
|
return 0;
|
|
@@ -18022,16 +18022,23 @@ struct llama_model * llama_load_model_from_file(
|
|
}
|
|
model->rpc_servers.push_back(servers);
|
|
}
|
|
- int status = llama_model_load(path_model, *model, params);
|
|
- GGML_ASSERT(status <= 0);
|
|
- if (status < 0) {
|
|
- if (status == -1) {
|
|
- LLAMA_LOG_ERROR("%s: failed to load model\n", __func__);
|
|
- } else if (status == -2) {
|
|
- LLAMA_LOG_INFO("%s: cancelled model load\n", __func__);
|
|
+
|
|
+ try {
|
|
+ int status = llama_model_load(path_model, *model, params);
|
|
+ GGML_ASSERT(status <= 0);
|
|
+ if (status < 0) {
|
|
+ if (status == -1) {
|
|
+ LLAMA_LOG_ERROR("%s: failed to load model\n", __func__);
|
|
+ } else if (status == -2) {
|
|
+ LLAMA_LOG_INFO("%s: cancelled model load\n", __func__);
|
|
+ }
|
|
+ delete model;
|
|
+ return nullptr;
|
|
}
|
|
+ } catch (...) {
|
|
+ LLAMA_LOG_ERROR("%s: exception loading model\n", __func__);
|
|
delete model;
|
|
- return nullptr;
|
|
+ throw;
|
|
}
|
|
|
|
return model;
|
|
--
|
|
2.46.0
|
|
|