Skip to content

Commit 3e18116

Browse files
committed
[Fix]Roll back the signature and implementation of clip_model_load, and change the call in clip_model_quantize to clip_init.
1 parent 6427ce9 commit 3e18116

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

examples/llava/clip.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,9 @@ static ggml_cgraph * clip_image_build_graph(clip_ctx * ctx, const clip_image_f32
13701370
}
13711371

13721372
// read and create ggml_context containing the tensors and their data
1373-
struct clip_ctx * clip_model_load(const char * fname, const int verbosity, const bool use_gpu) {
1373+
struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
13741374
return clip_init(fname, clip_context_params{
1375-
/* use_gpu */ use_gpu,
1375+
/* use_gpu */ true,
13761376
/* verbosity */ verbosity,
13771377
});
13781378
}
@@ -2989,7 +2989,10 @@ bool clip_model_quantize(const char * fname_inp, const char * fname_out, const i
29892989
assert(itype < GGML_TYPE_COUNT);
29902990
ggml_type type = static_cast<ggml_type>(itype);
29912991

2992-
auto * ctx_clip = clip_model_load(fname_inp, 2, false);
2992+
auto * ctx_clip = clip_init(fname_inp, clip_context_params{
2993+
/* use_gpu */ false,
2994+
/* verbosity */ 2,
2995+
});
29932996

29942997
const auto & ctx_src = ctx_clip->ctx_gguf;
29952998
const auto & ctx_data = ctx_clip->ctx_data;

examples/llava/clip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct clip_context_params {
4545
};
4646

4747
// deprecated, use clip_init
48-
CLIP_API struct clip_ctx * clip_model_load(const char * fname, const int verbosity=1, const bool use_gpu=true);
48+
CLIP_API struct clip_ctx * clip_model_load(const char * fname, int verbosity);
4949

5050
CLIP_API struct clip_ctx * clip_init(const char * fname, struct clip_context_params ctx_params);
5151

0 commit comments

Comments
 (0)