Skip to content

Conversation

@CodersAcademy006
Copy link

Enables single-scale inference for Sam3MaskDecoder, bringing parity with the original implementation where full FPN levels aren't strictly required. I modified the forward method to handle single-tensor inputs by bypassing the multi-scale fusion block and routing the feature directly through the primary projection layer.

This change is fully backward compatible: standard multi-scale inputs continue to use the existing FPN path. I also added a contract check that logs a warning when the input scale count deviates from the config, ensuring users are explicitly aware when the model falls back to single-scale mode. Tests added to verify both the new fallback path and regression safety.

Fixes #43043

@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: sam3

@github-actions
Copy link
Contributor

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43044&sha=0c13a7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single-scale image input support for SAM3 Mask Decoder

1 participant