Repository navigation
sam3 : SAM 3.1 (detector-only, transformers weights) support - #38
Open
ivanovalex32 wants to merge 1 commit into
Open
ivanovalex32 wants to merge 1 commit into
ivanovalex32 wants to merge 1 commit into
Conversation
- convert_sam31_to_ggml.py: safetensors->ggml converter with strict key validation and freqs_cis synthesis; --ftype 0/1 - runtime: tracker_present detection (file scan for neck.trk.) with PVS-API guards for detector-only models; padding mask in text encoder (sam3_fill_causal_mask now masks pad tokens as keys) - tests: e2e reference generator (transformers, ViT eps=1e-5, 0/1 masks), img_feats/img_pe as owned input tensors in phase5 dump, dbg_block_%d_out vit dumps - benchmark: --detect mode (text-prompt PCS per frame) for detector-only models - docs: README model zoo + feature matrix entries for SAM 3.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for SAM 3.1 (detector-only checkpoint converted from transformers weights, e.g. unsloth/sam3.1).
What's included
convert_sam31_to_ggml.py— safetensors -> ggml converter with strict key validation and on-the-fly RoPEfreqs_cissynthesis (window + global blocks).sam3_load_modelscans tensor names and disables tracker registration when the file has no tracker weights; PVS/tracking APIs fail with a clear error.sam3_fill_causal_masknow also masks padded token ids (aligns text features with the transformers reference).dbg_block_%d_out, prefix dumps) for the e2e test.--detect/--text-promptmodes insam3_benchmarkfor benchmarking detector-only models.tests/dump_sam31_pcs_reference.py— transformers-based Python reference for the e2e comparison.Test harness fixes (Release builds)
The phase5/phase6 dump helpers previously failed in Release builds (
#ifndef NDEBUG-guarded debug tensors missing from the graph). Missing dump tensors are now skipped with a warning instead of failing the run, and the FPN/neck inputs of the phase5 graph are materialized as graph inputs to avoid allocator reuse of encode-stage buffers.GPU / HIP testing
test_e2e_pcsnow accepts--gpu(and--n-threads N) and prints a performance summary (encode, phase5, end-to-end PCS). On a build with the HIP backend it validates the GPU path against the same Python reference.HIP numbers (gfx1151, ROCm), measured with
sam3_benchmark --detect(10 frames):Validation