diff --git a/sam3.cpp b/sam3.cpp index 43d88a8..edabaf9 100644 --- a/sam3.cpp +++ b/sam3.cpp @@ -3240,7 +3240,10 @@ std::shared_ptr sam3_load_model(const sam3_params& params) { fprintf(stderr, "%s: %s format v%d, ftype %d, %d tensors\n", __func__, is_sam2 ? "SAM2" : "SAM3", version, ftype, n_tensors); - auto model = std::make_shared(); + std::shared_ptr model(new sam3_model(), [](sam3_model* m) { + sam3_free_model(*m); + delete m; + }); { ggml_type wtype; switch (ftype) {