Project-MONAI / Project-MONAI/MONAILabel

Option to turn-off SAM model loading

Open
#1,898 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
891
Forks
269
Avg merge
15h 41m
Merged PRs (30d)
1

Description

Is your feature request related to a problem? Please describe.
Currently, when launching a MONAILabel app, the server automatically downloads and initializes SAM (Segment Anything Model) weights to support interactive features. This creates significant bottlenecks:

Redundant Loading: Many apps already use specialized interactive models (e.g., DeepEdit). Forcing SAM to load on top of these models is redundant and wastes VRAM/Memory.

Startup Latency: The mandatory download and initialization of SAM weights significantly slow down the server's "ready" time.

Describe the solution you'd like
I would like an option to disable or "lazy-load" SAM so it is only initialized if explicitly requested. Specifically:

A Configuration Flag: Add a server-side flag (e.g., --skip_sam or conf: { disable_sam: true }) to prevent the automatic download and loading of SAM weights.

Modular Interaction: Allow the primary segmentation model (like DeepEdit) to function as the sole interaction engine without SAM running in the background.

On-Demand Loading: If SAM is needed, it should be an optional "plugin" rather than a hard dependency of the app startup sequence.

Describe alternatives you've considered
None

Additional context
By making SAM optional, MONAILabel becomes much more efficient for users running specialized interactive models who don't need the generic SAM overhead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing MONAILabel app startup and locating where SAM weights are downloaded and initialized, along with the configuration or command-line entry points. The change is done when startup can skip SAM without breaking the primary interactive model, while SAM remains available when explicitly requested; add or update tests for both paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.