2024-10-17 18:59:52 +00:00
|
|
|
From 4f2b9cd0f012c49f40d0784454864ad41ca418b2 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Gabe Goodhart <ghart@us.ibm.com>
|
|
|
|
Date: Thu, 19 Sep 2024 17:00:28 -0600
|
|
|
|
Subject: [PATCH] load exception
|
2024-09-16 22:58:55 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
src/llama.cpp | 25 ++++++++++++++++---------
|
|
|
|
1 file changed, 16 insertions(+), 9 deletions(-)
|
|
|
|
|
2024-07-05 17:25:58 +00:00
|
|
|
diff --git a/src/llama.cpp b/src/llama.cpp
|
2024-10-17 18:59:52 +00:00
|
|
|
index af8afd84..4d1db3d5 100644
|
2024-07-05 17:25:58 +00:00
|
|
|
--- a/src/llama.cpp
|
|
|
|
+++ b/src/llama.cpp
|
2024-10-17 18:59:52 +00:00
|
|
|
@@ -8871,7 +8871,7 @@ static int llama_model_load(const std::string & fname, llama_model & model, llam
|
2024-03-11 20:48:27 +00:00
|
|
|
}
|
|
|
|
} catch (const std::exception & err) {
|
|
|
|
LLAMA_LOG_ERROR("%s: error loading model: %s\n", __func__, err.what());
|
|
|
|
- return -1;
|
|
|
|
+ throw;
|
|
|
|
}
|
|
|
|
|
2024-10-17 18:59:52 +00:00
|
|
|
// loading time will be recalculate after the first eval, so
|
|
|
|
@@ -18675,16 +18675,23 @@ struct llama_model * llama_load_model_from_file(
|
2024-05-23 21:16:26 +00:00
|
|
|
}
|
|
|
|
model->rpc_servers.push_back(servers);
|
2024-03-11 20:48:27 +00:00
|
|
|
}
|
|
|
|
- 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__);
|
2024-05-23 21:16:26 +00:00
|
|
|
+
|
2024-03-11 20:48:27 +00:00
|
|
|
+ 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;
|
2024-09-16 22:58:55 +00:00
|
|
|
--
|
2024-10-17 18:59:52 +00:00
|
|
|
2.39.3 (Apple Git-146)
|
2024-09-16 22:58:55 +00:00
|
|
|
|