Repository navigation
Add SAM 3.1 to Transformers - #46128
Open
yonigozlan wants to merge 6 commits into
Open
yonigozlan wants to merge 6 commits into
yonigozlan wants to merge 6 commits into
Conversation
|
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. |
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: auto, sam3, sam3_tracker_video, sam3_video |
Contributor
|
View the CircleCI Test Summary for this PR: |
|
is this PR stale or is it still being worked on? |
TheWisp
added a commit
to TheWisp/lerobot
that referenced
this pull request
Aug 3, 2026
…ring The registry-only sam3_1 adapter was hidden because its only wired path was the incremental per-frame shim: 692 ms/frame for 2 concepts (Meta's per-call fixed cost with no batch amortization) and degraded holds across one-frame windows. But our batch flows don't need streaming at all — an episode is a bounded frame sequence, which is exactly the offline shape Meta's session API is built for. process_episode() on the adapter runs Meta's native one-shot propagation per (camera, concept) over the whole episode (chunked at EPISODE_CHUNK frames) and caches per-frame masks; segment()/segment_many() then consume the cache in order, so the standard contract is unchanged. process_dataset() primes any adapter that declares process_episode by decoding the episode's edited cameras up front (one extra decode pass + episode frames in RAM), emitting a "segmenting" stage while the batch runs. Measured on the 5090 (240 frames, 2 concepts, native 1008): 84 ms/concept-frame — 8x the shim, equal to the reference implementation's throughput — with reference tracking quality (dowel held on every frame after first detection, vs lost after ~9 frames on the shim). End-to-end process_dataset in the sidecar env: 385 frames x 2 cams x 2 concepts in 164 s including model load. Spawn wiring: python_for_model() picks the sidecar interpreter (LEROBOT_SAM31_PYTHON, default ~/.cache/sam31/venv/bin/python) for sam3_1 and sys.executable for everything else; both the overlay-worker spawn and the process-job spawn use it, and /api/process/start plus the worker spawn fail with the sidecar setup recipe (400) when the venv is missing rather than dying after slot acquisition. sam3_1 is now listed in _STEPS for both tabs with the limitation stated in its hint: batch jobs and previews run at full speed; the live preview still uses the incremental shim (~1 fps, weaker holds) until the transformers port (huggingface/transformers#46128) supersedes the sidecar entirely. Guardrails: tests/gui/test_adapter_concept_base.py pins interpreter selection (sidecar only for sam3_1, actionable error when missing) and GUI listing; tests/datasets/test_dataset_postprocess.py pins the batch-adapter contract (whole episode per edited camera handed to process_episode, unchanged output). The 12 failing tests elsewhere in tests/gui (policy listing, recorder e2e) fail identically on the clean tree — pre-existing environment skew, not this change. Co-Authored-By: Claude Fable 5 <[email protected]>
TheWisp
added a commit
to TheWisp/lerobot
that referenced
this pull request
Aug 4, 2026
… sidecar, camera batching Rebased on top of the unified-rows redesign (the experimental adapters now plug into the unified render path: no per-object colours, chrome carries identity, and their masks flow through the same transparent-diff composite). The base data-editing PR ships one segmenter (sam3_track). This follow-up carries the three experimental additions held back for more soak time, each functional and measured but with a known caveat stated in its GUI hint: - sam3_video — Meta's unified Sam3VideoModel (detection + tracking + association every frame). ~52 ms/frame flat; the thin dowel sam3_track loses on ~37% of in-view frames is held on EVERY frame, and out-of-view objects are genuinely absent (no stale masks). Costs the detector every frame (~6 fps at 2 cams). Memory bounded by rolling session rebuild + masklet cap with empty-masklet decay (never evict streamed frames: the tracker sizes memory attention from frame count and eviction measurably lobotomises tracking). - sam3_1 — Meta's SAM 3.1 multiplex tracker via a sidecar venv (LEROBOT_SAM31_PYTHON; transformers has no port — upstream is huggingface/transformers#46128). Batch jobs and episode previews prime the adapter with the whole episode (process_episode) and run ONE native propagation per (camera, concept): 84 ms/concept-frame with reference holds. The live preview falls back to an incremental per-frame shim (~700 ms/frame, weaker holds) — superseded when the transformers port lands. python_for_model() selects the sidecar interpreter for both spawn paths; a missing venv fails with the setup recipe at request time. - camera batching — one batched vision encode per sweep (~1.3x at 2 cams), default OFF and labelled as quality-affecting: the batched kernels' numeric drift collapsed tracking holds on a real dataset (dowel 4/199 batched vs 24/199 serial on merged_raw ep157). Opt-in for users who verify holds on their own data; the flag rides the job config so preview == commit. Guardrails return with the features: registry/GUI listing and sidecar interpreter selection (test_adapter_concept_base.py, test_overlays.py), whole-episode batch priming (test_dataset_postprocess.py), batch_cameras config round-trip (test_process_endpoints.py). Co-Authored-By: Claude Fable 5 <[email protected]>
TheWisp
added a commit
to TheWisp/lerobot
that referenced
this pull request
Aug 4, 2026
… sidecar, camera batching Rebased on top of the unified-rows redesign (the experimental adapters now plug into the unified render path: no per-object colours, chrome carries identity, and their masks flow through the same transparent-diff composite). The base data-editing PR ships one segmenter (sam3_track). This follow-up carries the three experimental additions held back for more soak time, each functional and measured but with a known caveat stated in its GUI hint: - sam3_video — Meta's unified Sam3VideoModel (detection + tracking + association every frame). ~52 ms/frame flat; the thin dowel sam3_track loses on ~37% of in-view frames is held on EVERY frame, and out-of-view objects are genuinely absent (no stale masks). Costs the detector every frame (~6 fps at 2 cams). Memory bounded by rolling session rebuild + masklet cap with empty-masklet decay (never evict streamed frames: the tracker sizes memory attention from frame count and eviction measurably lobotomises tracking). - sam3_1 — Meta's SAM 3.1 multiplex tracker via a sidecar venv (LEROBOT_SAM31_PYTHON; transformers has no port — upstream is huggingface/transformers#46128). Batch jobs and episode previews prime the adapter with the whole episode (process_episode) and run ONE native propagation per (camera, concept): 84 ms/concept-frame with reference holds. The live preview falls back to an incremental per-frame shim (~700 ms/frame, weaker holds) — superseded when the transformers port lands. python_for_model() selects the sidecar interpreter for both spawn paths; a missing venv fails with the setup recipe at request time. - camera batching — one batched vision encode per sweep (~1.3x at 2 cams), default OFF and labelled as quality-affecting: the batched kernels' numeric drift collapsed tracking holds on a real dataset (dowel 4/199 batched vs 24/199 serial on merged_raw ep157). Opt-in for users who verify holds on their own data; the flag rides the job config so preview == commit. Guardrails return with the features: registry/GUI listing and sidecar interpreter selection (test_adapter_concept_base.py, test_overlays.py), whole-episode batch priming (test_dataset_postprocess.py), batch_cameras config round-trip (test_process_endpoints.py). Co-Authored-By: Claude Fable 5 <[email protected]>
TheWisp
added a commit
to TheWisp/lerobot
that referenced
this pull request
Aug 5, 2026
… sidecar, camera batching Rebased on top of the unified-rows redesign (the experimental adapters now plug into the unified render path: no per-object colours, chrome carries identity, and their masks flow through the same transparent-diff composite). The base data-editing PR ships one segmenter (sam3_track). This follow-up carries the three experimental additions held back for more soak time, each functional and measured but with a known caveat stated in its GUI hint: - sam3_video — Meta's unified Sam3VideoModel (detection + tracking + association every frame). ~52 ms/frame flat; the thin dowel sam3_track loses on ~37% of in-view frames is held on EVERY frame, and out-of-view objects are genuinely absent (no stale masks). Costs the detector every frame (~6 fps at 2 cams). Memory bounded by rolling session rebuild + masklet cap with empty-masklet decay (never evict streamed frames: the tracker sizes memory attention from frame count and eviction measurably lobotomises tracking). - sam3_1 — Meta's SAM 3.1 multiplex tracker via a sidecar venv (LEROBOT_SAM31_PYTHON; transformers has no port — upstream is huggingface/transformers#46128). Batch jobs and episode previews prime the adapter with the whole episode (process_episode) and run ONE native propagation per (camera, concept): 84 ms/concept-frame with reference holds. The live preview falls back to an incremental per-frame shim (~700 ms/frame, weaker holds) — superseded when the transformers port lands. python_for_model() selects the sidecar interpreter for both spawn paths; a missing venv fails with the setup recipe at request time. - camera batching — one batched vision encode per sweep (~1.3x at 2 cams), default OFF and labelled as quality-affecting: the batched kernels' numeric drift collapsed tracking holds on a real dataset (dowel 4/199 batched vs 24/199 serial on merged_raw ep157). Opt-in for users who verify holds on their own data; the flag rides the job config so preview == commit. Guardrails return with the features: registry/GUI listing and sidecar interpreter selection (test_adapter_concept_base.py, test_overlays.py), whole-episode batch priming (test_dataset_postprocess.py), batch_cameras config round-trip (test_process_endpoints.py). Co-Authored-By: Claude Fable 5 <[email protected]>
Collaborator
|
@yonigozlan this one has been waiting since 2026-06-25. Still planned, or should we close it? |
|
Hi, is there anyone still working with this? |
This branch has not been deployed
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?
First draft for SAM3.1 model.
Current state: