From 2a606f23faf2f11f9553091fb13a95876003a8a6 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 26 Jun 2023 14:41:34 +0300 Subject: [PATCH] wip --- examples/sam/main.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/examples/sam/main.cpp b/examples/sam/main.cpp index 3e798e2a8..ff2521962 100644 --- a/examples/sam/main.cpp +++ b/examples/sam/main.cpp @@ -914,7 +914,7 @@ bool sam_encode_image( } // TODO: avoid copy - cur = ggml_cpy(state.ctx, cur, state.embd_img); + //cur = ggml_cpy(state.ctx, cur, state.embd_img); ggml_set_name(cur, "check"); @@ -960,7 +960,6 @@ bool sam_encode_image( sum += data[i]; } printf("sum: %f\n", sum); - exit(0); }; auto print_t_f16 = [&](struct ggml_tensor * t) { @@ -983,7 +982,6 @@ bool sam_encode_image( sum += ggml_fp16_to_fp32(data[i]); } printf("sum: %f\n", sum); - exit(0); }; auto * t = ggml_get_tensor(ctx0, "check"); @@ -1129,7 +1127,6 @@ bool sam_encode_prompt( sum += data[i]; } printf("sum: %f\n", sum); - exit(0); }; auto print_t_f16 = [&](struct ggml_tensor * t) { @@ -1152,7 +1149,6 @@ bool sam_encode_prompt( sum += ggml_fp16_to_fp32(data[i]); } printf("sum: %f\n", sum); - exit(0); }; auto * t = ggml_get_tensor(ctx0, "check"); @@ -1230,10 +1226,10 @@ int main(int argc, char ** argv) { t_load_us = ggml_time_us() - t_start_us; } - //if (!sam_encode_image(model, img1, params.n_threads)) { - // fprintf(stderr, "%s: failed to encode image\n", __func__); - // return 1; - //} + if (!sam_encode_image(model, model.state, img1, params.n_threads)) { + fprintf(stderr, "%s: failed to encode image\n", __func__); + return 1; + } // TODO: user input const sam_point pt = { 414.375f, 162.796875f, };