Skip to content

[codex] Block legacy fine-tuned SAM3 loads#2278

Merged
hansent merged 4 commits intomainfrom
codex/block-legacy-sam3-loads
May 1, 2026
Merged

[codex] Block legacy fine-tuned SAM3 loads#2278
hansent merged 4 commits intomainfrom
codex/block-legacy-sam3-loads

Conversation

@hansent
Copy link
Copy Markdown
Collaborator

@hansent hansent commented Apr 27, 2026

Summary

  • block fine-tuned SAM3 legacy loads during Roboflow model type resolution when SAM3_FINE_TUNED_MODELS_ENABLED is disabled
  • return a dedicated 501 deployment-level error instead of falling through to a generic failure after model construction
  • add regression coverage for both the registry guard and the HTTP error mapping

Why

The legacy /{dataset}/{version} inference path could resolve a fine-tuned SAM3 model, instantiate SegmentAnything3, and download large SAM3 weights even on deployments where fine-tuned SAM3 loading is disabled. Inference then failed later because that endpoint cannot actually serve SAM3. This change short-circuits that path before model construction and weight download.

Impact

Serverless or otherwise restricted deployments now reject fine-tuned SAM3 model IDs earlier and more clearly, while core sam3/... models continue to work as before.

Validation

  • PYTHONPATH=/Users/hansent/.codex/worktrees/e7e5/inference/inference_models:/Users/hansent/.codex/worktrees/e7e5/inference uv run --no-project --with-requirements requirements/requirements.test.unit.txt pytest tests/inference/unit_tests/core/registries/test_roboflow.py tests/inference/unit_tests/core/interfaces/http/test_error_handlers.py
  • result: 65 passed

Copy link
Copy Markdown
Collaborator

@PawelPeczek-Roboflow PawelPeczek-Roboflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated in comment - if you have time, you can extend to other models, but since this is a good start, we can merge in this form

return project_task_type, model_type


def _ensure_model_supported_on_this_deployment(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this could work in much broader context - i.e for all models
but that's a good start so I am willing to approve

@hansent hansent enabled auto-merge (squash) May 1, 2026 16:39
@hansent hansent merged commit d68c3c7 into main May 1, 2026
45 of 46 checks passed
@hansent hansent deleted the codex/block-legacy-sam3-loads branch May 1, 2026 16:44
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.

2 participants