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) {
112112static struct ggml_tensor * get_tensor (struct ggml_context * ctx, const std::string & name) {
113113 struct ggml_tensor * cur = ggml_get_tensor (ctx, name.c_str ());
114114 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 ()));
117116 }
118117
119118 return cur;
@@ -136,7 +135,7 @@ static std::string get_ftype(int ftype) {
136135 case 8 :
137136 return " q8_0" ;
138137 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));
140139 }
141140}
142141
@@ -462,6 +461,9 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
462461 };
463462
464463 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+ }
465467
466468 if (verbosity >= 1 ) {
467469 const int n_tensors = gguf_get_n_tensors (ctx);
You can’t perform that action at this time.
0 commit comments