Skip to content

Commit 2a606f2

Browse files
committed
wip
1 parent dffd07e commit 2a606f2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

examples/sam/main.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ bool sam_encode_image(
914914
}
915915

916916
// TODO: avoid copy
917-
cur = ggml_cpy(state.ctx, cur, state.embd_img);
917+
//cur = ggml_cpy(state.ctx, cur, state.embd_img);
918918

919919
ggml_set_name(cur, "check");
920920

@@ -960,7 +960,6 @@ bool sam_encode_image(
960960
sum += data[i];
961961
}
962962
printf("sum: %f\n", sum);
963-
exit(0);
964963
};
965964

966965
auto print_t_f16 = [&](struct ggml_tensor * t) {
@@ -983,7 +982,6 @@ bool sam_encode_image(
983982
sum += ggml_fp16_to_fp32(data[i]);
984983
}
985984
printf("sum: %f\n", sum);
986-
exit(0);
987985
};
988986

989987
auto * t = ggml_get_tensor(ctx0, "check");
@@ -1129,7 +1127,6 @@ bool sam_encode_prompt(
11291127
sum += data[i];
11301128
}
11311129
printf("sum: %f\n", sum);
1132-
exit(0);
11331130
};
11341131

11351132
auto print_t_f16 = [&](struct ggml_tensor * t) {
@@ -1152,7 +1149,6 @@ bool sam_encode_prompt(
11521149
sum += ggml_fp16_to_fp32(data[i]);
11531150
}
11541151
printf("sum: %f\n", sum);
1155-
exit(0);
11561152
};
11571153

11581154
auto * t = ggml_get_tensor(ctx0, "check");
@@ -1230,10 +1226,10 @@ int main(int argc, char ** argv) {
12301226
t_load_us = ggml_time_us() - t_start_us;
12311227
}
12321228

1233-
//if (!sam_encode_image(model, img1, params.n_threads)) {
1234-
// fprintf(stderr, "%s: failed to encode image\n", __func__);
1235-
// return 1;
1236-
//}
1229+
if (!sam_encode_image(model, model.state, img1, params.n_threads)) {
1230+
fprintf(stderr, "%s: failed to encode image\n", __func__);
1231+
return 1;
1232+
}
12371233

12381234
// TODO: user input
12391235
const sam_point pt = { 414.375f, 162.796875f, };

0 commit comments

Comments
 (0)