3
3
// I'll gradually clean and extend it
4
4
// Note: Even when using identical normalized image inputs (see normalize_image_u8_to_f32()) we have a significant difference in resulting embeddings compared to pytorch
5
5
#include " clip.h"
6
+ #include " log.h"
6
7
#include " ggml.h"
7
8
#include " ggml-alloc.h"
8
9
#include " ggml-backend.h"
23
24
#include < cstdlib>
24
25
#include < cstring>
25
26
#include < fstream>
26
- #include < iostream>
27
27
#include < map>
28
28
#include < regex>
29
29
#include < stdexcept>
@@ -145,7 +145,7 @@ static std::map<projector_type, std::string> PROJECTOR_TYPE_NAMES = {
145
145
static int get_key_idx (const gguf_context * ctx, const char * key) {
146
146
int i = gguf_find_key (ctx, key);
147
147
if (i == -1 ) {
148
- fprintf (stderr, " key %s not found in file\n " , key);
148
+ LOG_TEE ( " key %s not found in file\n " , key);
149
149
throw std::runtime_error (format (" Missing required key: %s" , key));
150
150
}
151
151
@@ -247,7 +247,7 @@ static std::string gguf_kv_to_str(const struct gguf_context * ctx_gguf, int i) {
247
247
248
248
static void print_tensor_info (const ggml_tensor * tensor, const char * prefix = " " ) {
249
249
size_t tensor_size = ggml_nbytes (tensor);
250
- printf (" %s: n_dims = %d, name = %s, tensor_size=%zu, shape:[%" PRId64 " , %" PRId64 " , %" PRId64 " , %" PRId64 " ], type = %s\n " ,
250
+ LOG_TEE (" %s: n_dims = %d, name = %s, tensor_size=%zu, shape:[%" PRId64 " , %" PRId64 " , %" PRId64 " , %" PRId64 " ], type = %s\n " ,
251
251
prefix, ggml_n_dims (tensor), tensor->name , tensor_size,
252
252
tensor->ne [0 ], tensor->ne [1 ], tensor->ne [2 ], tensor->ne [3 ], ggml_type_name (tensor->type ));
253
253
}
@@ -265,7 +265,7 @@ static projector_type clip_projector_type_from_string(const std::string & name)
265
265
static void clip_image_write_image_to_ppm (const clip_image_u8& img, const std::string& filename) {
266
266
std::ofstream file (filename, std::ios::binary);
267
267
if (!file.is_open ()) {
268
- std::cerr << " Failed to open file for writing: " << filename << std::endl ;
268
+ LOG_TEE ( " Failed to open file for writing: %s \n " , filename. c_str ()) ;
269
269
return ;
270
270
}
271
271
@@ -284,7 +284,7 @@ static void clip_image_write_image_to_ppm(const clip_image_u8& img, const std::s
284
284
static void clip_image_save_to_bmp (const clip_image_u8& img, const std::string& filename) {
285
285
std::ofstream file (filename, std::ios::binary);
286
286
if (!file.is_open ()) {
287
- std::cerr << " Failed to open file for writing: " << filename << std::endl ;
287
+ LOG_TEE ( " Failed to open file for writing: %s \n " , filename. c_str ()) ;
288
288
return ;
289
289
}
290
290
@@ -515,7 +515,7 @@ struct clip_ctx {
515
515
516
516
static ggml_cgraph * clip_image_build_graph (clip_ctx * ctx, const clip_image_f32_batch * imgs) {
517
517
if (!ctx->has_vision_encoder ) {
518
- printf (" This gguf file seems to have no vision encoder\n " );
518
+ LOG_TEE (" This gguf file seems to have no vision encoder\n " );
519
519
return nullptr ;
520
520
}
521
521
@@ -879,21 +879,21 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
879
879
const int idx_name = gguf_find_key (ctx, KEY_NAME);
880
880
if (idx_name != -1 ) { // make name optional temporarily as some of the uploaded models missing it due to a bug
881
881
const std::string name = gguf_get_val_str (ctx, idx_name);
882
- printf (" %s: model name: %s\n " , __func__, name.c_str ());
882
+ LOG_TEE (" %s: model name: %s\n " , __func__, name.c_str ());
883
883
}
884
- printf (" %s: description: %s\n " , __func__, description.c_str ());
885
- printf (" %s: GGUF version: %d\n " , __func__, gguf_get_version (ctx));
886
- printf (" %s: alignment: %zu\n " , __func__, gguf_get_alignment (ctx));
887
- printf (" %s: n_tensors: %d\n " , __func__, n_tensors);
888
- printf (" %s: n_kv: %d\n " , __func__, n_kv);
889
- printf (" %s: ftype: %s\n " , __func__, ftype_str.c_str ());
890
- printf (" \n " );
884
+ LOG_TEE (" %s: description: %s\n " , __func__, description.c_str ());
885
+ LOG_TEE (" %s: GGUF version: %d\n " , __func__, gguf_get_version (ctx));
886
+ LOG_TEE (" %s: alignment: %zu\n " , __func__, gguf_get_alignment (ctx));
887
+ LOG_TEE (" %s: n_tensors: %d\n " , __func__, n_tensors);
888
+ LOG_TEE (" %s: n_kv: %d\n " , __func__, n_kv);
889
+ LOG_TEE (" %s: ftype: %s\n " , __func__, ftype_str.c_str ());
890
+ LOG_TEE (" \n " );
891
891
}
892
892
const int n_tensors = gguf_get_n_tensors (ctx);
893
893
894
894
// kv
895
895
const int n_kv = gguf_get_n_kv (ctx);
896
- printf (" %s: loaded meta data with %d key-value pairs and %d tensors from %s\n " ,
896
+ LOG_TEE (" %s: loaded meta data with %d key-value pairs and %d tensors from %s\n " ,
897
897
__func__, n_kv, n_tensors, fname);
898
898
{
899
899
std::map<enum ggml_type, uint32_t > n_type;
@@ -904,7 +904,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
904
904
n_type[type]++;
905
905
}
906
906
907
- printf (" %s: Dumping metadata keys/values. Note: KV overrides do not apply in this output.\n " , __func__);
907
+ LOG_TEE (" %s: Dumping metadata keys/values. Note: KV overrides do not apply in this output.\n " , __func__);
908
908
for (int i = 0 ; i < n_kv; i++) {
909
909
const char * name = gguf_get_key (ctx, i);
910
910
const enum gguf_type type = gguf_get_kv_type (ctx, i);
@@ -920,7 +920,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
920
920
}
921
921
replace_all (value, " \n " , " \\ n" );
922
922
923
- printf (" %s: - kv %3d: %42s %-16s = %s\n " , __func__, i, name, type_name.c_str (), value.c_str ());
923
+ LOG_TEE (" %s: - kv %3d: %42s %-16s = %s\n " , __func__, i, name, type_name.c_str (), value.c_str ());
924
924
}
925
925
926
926
// print type counts
@@ -929,7 +929,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
929
929
continue ;
930
930
}
931
931
932
- printf (" %s: - type %4s: %4d tensors\n " , __func__, ggml_type_name (kv.first ), kv.second );
932
+ LOG_TEE (" %s: - type %4s: %4d tensors\n " , __func__, ggml_type_name (kv.first ), kv.second );
933
933
}
934
934
}
935
935
@@ -944,7 +944,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
944
944
size_t tensor_size = ggml_nbytes (cur);
945
945
model_size += tensor_size;
946
946
if (verbosity >= 3 ) {
947
- printf (" %s: tensor[%d]: n_dims = %d, name = %s, tensor_size=%zu, offset=%zu, shape:[%" PRIu64 " , %" PRIu64 " , %" PRIu64 " , %" PRIu64 " ], type = %s\n " ,
947
+ LOG_TEE (" %s: tensor[%d]: n_dims = %d, name = %s, tensor_size=%zu, offset=%zu, shape:[%" PRIu64 " , %" PRIu64 " , %" PRIu64 " , %" PRIu64 " ], type = %s\n " ,
948
948
__func__, i, ggml_n_dims (cur), cur->name , tensor_size, offset, cur->ne [0 ], cur->ne [1 ], cur->ne [2 ], cur->ne [3 ], ggml_type_name (type));
949
949
}
950
950
}
@@ -971,18 +971,18 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
971
971
972
972
#ifdef GGML_USE_CUDA
973
973
new_clip->backend = ggml_backend_cuda_init (0 );
974
- printf (" %s: CLIP using CUDA backend\n " , __func__);
974
+ LOG_TEE (" %s: CLIP using CUDA backend\n " , __func__);
975
975
#endif
976
976
977
977
#ifdef GGML_USE_METAL
978
978
new_clip->backend = ggml_backend_metal_init ();
979
- printf (" %s: CLIP using Metal backend\n " , __func__);
979
+ LOG_TEE (" %s: CLIP using Metal backend\n " , __func__);
980
980
#endif
981
981
982
982
983
983
if (!new_clip->backend ) {
984
984
new_clip->backend = ggml_backend_cpu_init ();
985
- printf (" %s: CLIP using CPU backend\n " , __func__);
985
+ LOG_TEE (" %s: CLIP using CPU backend\n " , __func__);
986
986
}
987
987
988
988
// model size and capabilities
@@ -1006,15 +1006,15 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
1006
1006
new_clip->use_gelu = gguf_get_val_bool (ctx, idx);
1007
1007
1008
1008
if (verbosity >= 1 ) {
1009
- printf (" %s: text_encoder: %d\n " , __func__, new_clip->has_text_encoder );
1010
- printf (" %s: vision_encoder: %d\n " , __func__, new_clip->has_vision_encoder );
1011
- printf (" %s: llava_projector: %d\n " , __func__, new_clip->has_llava_projector );
1012
- printf (" %s: model size: %.2f MB\n " , __func__, model_size / 1024.0 / 1024.0 );
1013
- printf (" %s: metadata size: %.2f MB\n " , __func__, ggml_get_mem_size (meta) / 1024.0 / 1024.0 );
1009
+ LOG_TEE (" %s: text_encoder: %d\n " , __func__, new_clip->has_text_encoder );
1010
+ LOG_TEE (" %s: vision_encoder: %d\n " , __func__, new_clip->has_vision_encoder );
1011
+ LOG_TEE (" %s: llava_projector: %d\n " , __func__, new_clip->has_llava_projector );
1012
+ LOG_TEE (" %s: model size: %.2f MB\n " , __func__, model_size / 1024.0 / 1024.0 );
1013
+ LOG_TEE (" %s: metadata size: %.2f MB\n " , __func__, ggml_get_mem_size (meta) / 1024.0 / 1024.0 );
1014
1014
}
1015
1015
}
1016
1016
1017
- printf (" %s: params backend buffer size = % 6.2f MB (%i tensors)\n " , __func__, model_size / (1024.0 * 1024.0 ), n_tensors);
1017
+ LOG_TEE (" %s: params backend buffer size = % 6.2f MB (%i tensors)\n " , __func__, model_size / (1024.0 * 1024.0 ), n_tensors);
1018
1018
1019
1019
// load tensors
1020
1020
{
@@ -1027,15 +1027,15 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
1027
1027
1028
1028
new_clip->ctx_data = ggml_init (params);
1029
1029
if (!new_clip->ctx_data ) {
1030
- fprintf (stderr, " %s: ggml_init() failed\n " , __func__);
1030
+ LOG_TEE ( " %s: ggml_init() failed\n " , __func__);
1031
1031
clip_free (new_clip);
1032
1032
gguf_free (ctx);
1033
1033
return nullptr ;
1034
1034
}
1035
1035
1036
1036
auto fin = std::ifstream (fname, std::ios::binary);
1037
1037
if (!fin) {
1038
- printf (" cannot open model file for loading tensors\n " );
1038
+ LOG_TEE (" cannot open model file for loading tensors\n " );
1039
1039
clip_free (new_clip);
1040
1040
gguf_free (ctx);
1041
1041
return nullptr ;
@@ -1057,7 +1057,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
1057
1057
const size_t offset = gguf_get_data_offset (ctx) + gguf_get_tensor_offset (ctx, i);
1058
1058
fin.seekg (offset, std::ios::beg);
1059
1059
if (!fin) {
1060
- printf (" %s: failed to seek for tensor %s\n " , __func__, name);
1060
+ LOG_TEE (" %s: failed to seek for tensor %s\n " , __func__, name);
1061
1061
clip_free (new_clip);
1062
1062
gguf_free (ctx);
1063
1063
return nullptr ;
@@ -1128,23 +1128,23 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
1128
1128
}
1129
1129
1130
1130
if (verbosity >= 2 ) {
1131
- printf (" \n %s: vision model hparams\n " , __func__);
1132
- printf (" image_size %d\n " , hparams.image_size );
1133
- printf (" patch_size %d\n " , hparams.patch_size );
1134
- printf (" v_hidden_size %d\n " , hparams.hidden_size );
1135
- printf (" v_n_intermediate %d\n " , hparams.n_intermediate );
1136
- printf (" v_projection_dim %d\n " , hparams.projection_dim );
1137
- printf (" v_n_head %d\n " , hparams.n_head );
1138
- printf (" v_n_layer %d\n " , hparams.n_layer );
1139
- printf (" v_eps %f\n " , hparams.eps );
1140
- printf (" v_image_mean %f %f %f\n " , new_clip->image_mean [0 ], new_clip->image_mean [1 ], new_clip->image_mean [2 ]);
1141
- printf (" v_image_std %f %f %f\n " , new_clip->image_std [0 ], new_clip->image_std [1 ], new_clip->image_std [2 ]);
1142
- printf (" v_image_grid_pinpoints: " );
1131
+ LOG_TEE (" \n %s: vision model hparams\n " , __func__);
1132
+ LOG_TEE (" image_size %d\n " , hparams.image_size );
1133
+ LOG_TEE (" patch_size %d\n " , hparams.patch_size );
1134
+ LOG_TEE (" v_hidden_size %d\n " , hparams.hidden_size );
1135
+ LOG_TEE (" v_n_intermediate %d\n " , hparams.n_intermediate );
1136
+ LOG_TEE (" v_projection_dim %d\n " , hparams.projection_dim );
1137
+ LOG_TEE (" v_n_head %d\n " , hparams.n_head );
1138
+ LOG_TEE (" v_n_layer %d\n " , hparams.n_layer );
1139
+ LOG_TEE (" v_eps %f\n " , hparams.eps );
1140
+ LOG_TEE (" v_image_mean %f %f %f\n " , new_clip->image_mean [0 ], new_clip->image_mean [1 ], new_clip->image_mean [2 ]);
1141
+ LOG_TEE (" v_image_std %f %f %f\n " , new_clip->image_std [0 ], new_clip->image_std [1 ], new_clip->image_std [2 ]);
1142
+ LOG_TEE (" v_image_grid_pinpoints: " );
1143
1143
for (int i = 0 ; i < 32 && (hparams.image_grid_pinpoints [i] != 0 ); ++i) {
1144
- printf (" %d " , hparams.image_grid_pinpoints [i]);
1144
+ LOG_TEE (" %d " , hparams.image_grid_pinpoints [i]);
1145
1145
}
1146
- printf (" \n " );
1147
- printf (" v_mm_patch_merge_type: %s\n " , hparams.mm_patch_merge_type );
1146
+ LOG_TEE (" \n " );
1147
+ LOG_TEE (" v_mm_patch_merge_type: %s\n " , hparams.mm_patch_merge_type );
1148
1148
1149
1149
}
1150
1150
@@ -1155,7 +1155,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
1155
1155
vision_model.pre_ln_w = get_tensor (new_clip->ctx_data , format (TN_LN_PRE, " v" , " weight" ));
1156
1156
vision_model.pre_ln_b = get_tensor (new_clip->ctx_data , format (TN_LN_PRE, " v" , " bias" ));
1157
1157
} catch (const std::exception & e) {
1158
- fprintf (stderr, " %s: failed to load vision model tensors\n " , __func__);
1158
+ LOG_TEE ( " %s: failed to load vision model tensors\n " , __func__);
1159
1159
}
1160
1160
1161
1161
// LLaVA projection
@@ -1184,7 +1184,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
1184
1184
} catch (std::runtime_error & e) { }
1185
1185
try {
1186
1186
vision_model.image_newline = get_tensor (new_clip->ctx_data , TN_IMAGE_NEWLINE);
1187
- // fprintf(stderr, "%s: image_newline tensor (llava-1.6) found\n", __func__);
1187
+ // LOG_TEE( "%s: image_newline tensor (llava-1.6) found\n", __func__);
1188
1188
} catch (std::runtime_error & e) { }
1189
1189
} else if (new_clip->proj_type == PROJECTOR_TYPE_LDP) {
1190
1190
// MobileVLM projection
@@ -1264,7 +1264,7 @@ struct clip_ctx * clip_model_load(const char * fname, const int verbosity = 1) {
1264
1264
ggml_cgraph * gf = clip_image_build_graph (new_clip, &batch);
1265
1265
ggml_gallocr_reserve (new_clip->compute_alloc , gf);
1266
1266
size_t compute_memory_buffer_size = ggml_gallocr_get_buffer_size (new_clip->compute_alloc , 0 );
1267
- printf (" %s: compute allocated memory: %.2f MB\n " , __func__, compute_memory_buffer_size /1024.0 /1024.0 );
1267
+ LOG_TEE (" %s: compute allocated memory: %.2f MB\n " , __func__, compute_memory_buffer_size /1024.0 /1024.0 );
1268
1268
}
1269
1269
1270
1270
return new_clip;
@@ -1304,7 +1304,7 @@ bool clip_image_load_from_file(const char * fname, clip_image_u8 * img) {
1304
1304
int nx, ny, nc;
1305
1305
auto * data = stbi_load (fname, &nx, &ny, &nc, 3 );
1306
1306
if (!data) {
1307
- fprintf (stderr, " %s: failed to load image '%s'\n " , __func__, fname);
1307
+ LOG_TEE ( " %s: failed to load image '%s'\n " , __func__, fname);
1308
1308
return false ;
1309
1309
}
1310
1310
build_clip_img_from_data (data, nx, ny, img);
@@ -1316,7 +1316,7 @@ bool clip_image_load_from_bytes(const unsigned char * bytes, size_t bytes_length
1316
1316
int nx, ny, nc;
1317
1317
auto * data = stbi_load_from_memory (bytes, bytes_length, &nx, &ny, &nc, 3 );
1318
1318
if (!data) {
1319
- fprintf (stderr, " %s: failed to decode image bytes\n " , __func__);
1319
+ LOG_TEE ( " %s: failed to decode image bytes\n " , __func__);
1320
1320
return false ;
1321
1321
}
1322
1322
build_clip_img_from_data (data, nx, ny, img);
@@ -1506,7 +1506,7 @@ static std::pair<int, int> select_best_resolution(const std::pair<int, int> & or
1506
1506
int downscaled_height = static_cast <int >(original_height * scale);
1507
1507
int effective_resolution = std::min (downscaled_width * downscaled_height, original_width * original_height);
1508
1508
int wasted_resolution = (width * height) - effective_resolution;
1509
- // fprintf(stderr, "resolution: %d %d, scale: %f, downscaled: %d %d, effective: %d, wasted: %d\n", width, height, scale, downscaled_width, downscaled_height, effective_resolution, wasted_resolution);
1509
+ // LOG_TEE( "resolution: %d %d, scale: %f, downscaled: %d %d, effective: %d, wasted: %d\n", width, height, scale, downscaled_width, downscaled_height, effective_resolution, wasted_resolution);
1510
1510
if (effective_resolution > max_effective_resolution || (effective_resolution == max_effective_resolution && wasted_resolution < min_wasted_resolution)) {
1511
1511
max_effective_resolution = effective_resolution;
1512
1512
min_wasted_resolution = wasted_resolution;
@@ -1545,7 +1545,7 @@ static std::vector<clip_image_u8*> divide_to_patches_u8(const clip_image_u8 & im
1545
1545
bool clip_image_preprocess (struct clip_ctx * ctx, const clip_image_u8 * img, clip_image_f32_batch * res_imgs) {
1546
1546
bool pad_to_square = true ;
1547
1547
if (!ctx->has_vision_encoder ) {
1548
- printf (" This gguf file seems to have no vision encoder\n " );
1548
+ LOG_TEE (" This gguf file seems to have no vision encoder\n " );
1549
1549
return false ;
1550
1550
}
1551
1551
auto & params = ctx->vision_model .hparams ;
@@ -1622,7 +1622,7 @@ bool clip_image_preprocess(struct clip_ctx * ctx, const clip_image_u8 * img, cli
1622
1622
}
1623
1623
1624
1624
for (size_t i = 0 ; i < patches.size (); i++) {
1625
- // printf ("patch %d: %d %d\n", i, patches[i]->nx, patches[i]->ny);
1625
+ // LOG_TEE ("patch %d: %d %d\n", i, patches[i]->nx, patches[i]->ny);
1626
1626
clip_image_u8_free (patches[i]);
1627
1627
}
1628
1628
@@ -1765,7 +1765,7 @@ int clip_n_patches(const struct clip_ctx * ctx) {
1765
1765
1766
1766
bool clip_image_encode (struct clip_ctx * ctx, const int n_threads, clip_image_f32 * img, float * vec) {
1767
1767
if (!ctx->has_vision_encoder ) {
1768
- printf (" This gguf file seems to have no vision encoder\n " );
1768
+ LOG_TEE (" This gguf file seems to have no vision encoder\n " );
1769
1769
return false ;
1770
1770
}
1771
1771
@@ -1777,7 +1777,7 @@ bool clip_image_encode(struct clip_ctx * ctx, const int n_threads, clip_image_f3
1777
1777
1778
1778
bool clip_image_batch_encode (clip_ctx * ctx, const int n_threads, const clip_image_f32_batch * imgs, float * vec) {
1779
1779
if (!ctx->has_vision_encoder ) {
1780
- printf (" This gguf file seems to have no vision encoder\n " );
1780
+ LOG_TEE (" This gguf file seems to have no vision encoder\n " );
1781
1781
return false ;
1782
1782
}
1783
1783
@@ -1939,7 +1939,7 @@ bool clip_model_quantize(const char * fname_inp, const char * fname_out, const i
1939
1939
new_type = type;
1940
1940
if (new_type >= GGML_TYPE_Q2_K && name.find (" embd" ) != std::string::npos) {
1941
1941
new_type = GGML_TYPE_Q8_0; // ggml_get_rows needs non K type
1942
- // fprintf(stderr, "%s: quantizing %s to %s\n", __func__, name.c_str(), ggml_type_name(new_type));
1942
+ // LOG_TEE( "%s: quantizing %s to %s\n", __func__, name.c_str(), ggml_type_name(new_type));
1943
1943
}
1944
1944
const size_t n_elms = ggml_nelements (cur);
1945
1945
float * f32_data;
@@ -1958,7 +1958,7 @@ bool clip_model_quantize(const char * fname_inp, const char * fname_out, const i
1958
1958
f32_data = (float *)conv_buf.data ();
1959
1959
break ;
1960
1960
default :
1961
- printf (" Please use an input file in f32 or f16\n " );
1961
+ LOG_TEE (" Please use an input file in f32 or f16\n " );
1962
1962
gguf_free (ctx_out);
1963
1963
return false ;
1964
1964
}
@@ -1985,7 +1985,7 @@ bool clip_model_quantize(const char * fname_inp, const char * fname_out, const i
1985
1985
fout.put (0 );
1986
1986
}
1987
1987
1988
- printf (" %s: n_dims = %d | quantize=%d | size = %f MB -> %f MB\n " , name.c_str (), ggml_n_dims (cur), quantize,
1988
+ LOG_TEE (" %s: n_dims = %d | quantize=%d | size = %f MB -> %f MB\n " , name.c_str (), ggml_n_dims (cur), quantize,
1989
1989
orig_size / 1024.0 / 1024.0 , new_size / 1024.0 / 1024.0 );
1990
1990
}
1991
1991
@@ -2001,8 +2001,8 @@ bool clip_model_quantize(const char * fname_inp, const char * fname_out, const i
2001
2001
gguf_free (ctx_out);
2002
2002
2003
2003
{
2004
- printf (" %s: original size = %8.2f MB\n " , __func__, total_size_org / 1024.0 / 1024.0 );
2005
- printf (" %s: quantized size = %8.2f MB\n " , __func__, total_size_new / 1024.0 / 1024.0 );
2004
+ LOG_TEE (" %s: original size = %8.2f MB\n " , __func__, total_size_org / 1024.0 / 1024.0 );
2005
+ LOG_TEE (" %s: quantized size = %8.2f MB\n " , __func__, total_size_new / 1024.0 / 1024.0 );
2006
2006
}
2007
2007
2008
2008
return true ;
0 commit comments