Add SAM 3.1#45110
Open
NielsRogge wants to merge 4 commits intohuggingface:mainfrom
Open
Conversation
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: auto, sam3, sam3_1_video |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
JavierYepez
reviewed
Mar 30, 2026
|
Is this going to be merged? |
This was referenced Apr 29, 2026
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.
What does this PR do?
[disclaimer: PR was entirely written by Codex where I just nudge it in the right directions, similar to #44285]
Feature request
I'd like to add support for Meta's SAM 3.1 release to
transformers.SAM 3.1 does not look like a simple checkpoint refresh for the video stack. The upstream release introduces the new Object Multiplex tracking architecture, so for video this is not just a drop-in replacement for the existing SAM 3 /
sam3_videoimplementation.Proposed scope
I have a local implementation working for the following scope:
Image support for SAM 3.1 via the existing
sam3image familySam3Modelfor image inference.facebook/sam3.1checkpoint and extract the detector weights from it.New
sam3_1_videomodel family for SAM 3.1 videosam3_1_videoimplementation based on the SAM 3.1 multiplex tracker architecture.modular_sam3_1_video.py), with generated config/modeling files.sam3.1_multiplex.ptcheckpoint and verifies parity against the upstream implementation.Docs and tests
sam3_1andsam3_1_video.sam3_1_videomodel family.Local status
This is already working locally against the upstream SAM 3.1 codebase and checkpoint:
facebook/sam3.1succeedsfacebook/sam3.1succeedsmake check-repopasses locallyWhy a new
sam3_1_videofamily?My current recommendation is:
sam3image familysam3_1_videofamily for video, since the multiplex tracker architecture and checkpoint layout differ from the current SAM 3 video implementationThis keeps the image path minimal while avoiding forcing the existing
sam3_videocode into a checkpoint-incompatible architecture jump.Open questions for maintainers
Codex also had some questions to confirm the expected scope and structure:
sam3_1_videomodel family the preferred approach for SAM 3.1 video support?sam3family rather than adding a separatesam3_1image model class?sam3_1_videocore model onlyTo do: