| 3348 | } |
| 3349 | |
| 3350 | void sam3_free_model(sam3_model& model) { |
| 3351 | if (model.buffer) { |
| 3352 | ggml_backend_buffer_free(model.buffer); |
| 3353 | model.buffer = nullptr; |
| 3354 | } |
| 3355 | if (model.ctx) { |
| 3356 | ggml_free(model.ctx); |
| 3357 | model.ctx = nullptr; |
| 3358 | } |
| 3359 | if (model.backend) { |
| 3360 | ggml_backend_free(model.backend); |
| 3361 | model.backend = nullptr; |
| 3362 | } |
| 3363 | } |
| 3364 | |
| 3365 | bool sam3_is_visual_only(const sam3_model& model) { |
| 3366 | return model.hparams.visual_only != 0 || model.hparams.is_sam2() || model.hparams.is_edgetam(); |
no outgoing calls