| 2 | #include <cstdio> |
| 3 | |
| 4 | int main(int argc, char ** argv) { |
| 5 | if (argc < 2) { |
| 6 | fprintf(stderr, "Usage: %s <model.ggml>\n", argv[0]); |
| 7 | return 1; |
| 8 | } |
| 9 | |
| 10 | sam3_params params; |
| 11 | params.model_path = argv[1]; |
| 12 | params.use_gpu = true; |
| 13 | params.n_threads = 4; |
| 14 | |
| 15 | auto model = sam3_load_model(params); |
| 16 | if (!model) { |
| 17 | fprintf(stderr, "Failed to load model\n"); |
| 18 | return 1; |
| 19 | } |
| 20 | |
| 21 | fprintf(stderr, "Model loaded successfully!\n"); |
| 22 | |
| 23 | auto state = sam3_create_state(*model, params); |
| 24 | if (!state) { |
| 25 | fprintf(stderr, "Failed to create state\n"); |
| 26 | return 1; |
| 27 | } |
| 28 | |
| 29 | fprintf(stderr, "State created successfully!\n"); |
| 30 | |
| 31 | // Explicit cleanup before ggml global shutdown |
| 32 | state.reset(); |
| 33 | sam3_free_model(*model); |
| 34 | model.reset(); |
| 35 | |
| 36 | fprintf(stderr, "Cleanup complete.\n"); |
| 37 | return 0; |
| 38 | } |
nothing calls this directly
no test coverage detected