File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,7 @@ static float get_f32(const gguf_context * ctx, const std::string & key) {
112
112
static struct ggml_tensor * get_tensor (struct ggml_context * ctx, const std::string & name) {
113
113
struct ggml_tensor * cur = ggml_get_tensor (ctx, name.c_str ());
114
114
if (!cur) {
115
- printf (" unable to find tensor %s\n " , name.c_str ());
116
- throw std::runtime_error (format (" unable to find tensor %s\n " , name.c_str ()));
115
+ throw std::runtime_error (format (" %s: unable to find tensor %s\n " , __func__, name.c_str ()));
117
116
}
118
117
119
118
return cur;
@@ -136,7 +135,7 @@ static std::string get_ftype(int ftype) {
136
135
case 8 :
137
136
return " q8_0" ;
138
137
default :
139
- throw std::runtime_error (format (" Unrecognized file type: %d\n " , ftype));
138
+ throw std::runtime_error (format (" %s: Unrecognized file type: %d\n " , __func__ , ftype));
140
139
}
141
140
}
142
141
@@ -462,6 +461,9 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
462
461
};
463
462
464
463
struct gguf_context * ctx = gguf_init_from_file (fname, params);
464
+ if (!ctx) {
465
+ throw std::runtime_error (format (" %s: failed to load CLIP model from %s. Does this file exist?\n " , __func__, fname));
466
+ }
465
467
466
468
if (verbosity >= 1 ) {
467
469
const int n_tensors = gguf_get_n_tensors (ctx);
You can’t perform that action at this time.
0 commit comments