SAM 2.1 Hiera-tiny, GGUF (image mode)

GGUF conversion of Meta's SAM 2.1 Hiera-tiny for CrispEmbed's ggml SAM 2.1 engine (src/sam2.cpp, C API crispembed_sam2_*): single-image segmentation with point and box prompts. The video-memory parts of SAM 2 are not included. Used by the sam mask provider of Crisp 3D Studio.

File Precision Size SHA-256
sam2.1-hiera-tiny-f16.gguf F16 (recommended) 62.9 MB b1e5c7a8d548f8545fb60a002883cb089aa5290ab6a2c549a0b4750f31b4fb39
sam2.1-hiera-tiny-f32.gguf F32 125 MB 02ac9814abfe82ab5584b881f9137af39a1d364c855c1143f587f8dd5d73d901

Converted with models/convert-sam2-to-gguf.py in CrispEmbed (296 tensors; the trunk's bicubic position-embedding resize is stored as a 256×7 resampling matrix, so the runtime needs no bicubic code). F16 is lossless against F32 (encoder cosine ≥ 0.999999, logits 1.000000, identical masks) at half the size. Q8_0 was measured and not published: one of the four mask outputs dropped to IoU 0.9895 against PyTorch; Q4_K is unusable for this model.

Verification

CrispEmbed's test-sam2-diff against PyTorch 2.7 on the CPU, one 1749×1155 photo with a box, four object points and one background point: cosine 1.000000 at every stage (patch embedding, all 12 Hiera blocks, FPN, the three decoder inputs, mask logits), largest difference 3.6e-5 on the mask logits, scores exact, the four masks identical (25 of 25 checks pass).

Compare against PyTorch on the CPU, not Apple's MPS backend: PyTorch 2.7 on MPS computes the strided query max_pool2d in the Hiera encoder incorrectly (a contiguous copy before the pool fixes it).

License

Apache-2.0, as the original model: SAM 2 is Copyright Meta Platforms, Inc. and affiliates. This repository redistributes converted weights under the same license (see LICENSE); the conversion changes the format only, not the weights.

ONNX export of the same model: cstr/sam2.1-hiera-tiny-ONNX.

Downloads last month
44
GGUF
Model size
31.3M params
Architecture
sam2
Hardware compatibility
Log In to add your hardware

16-bit

32-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for cstr/sam2.1-hiera-tiny-GGUF

Quantized
(12)
this model