Repository navigation
Add global MONAI_LABEL_SKIP_SAM flag to skip SAM model loading - #1914
habib-analyst wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughAdds the ChangesSAM/SAM2 opt-out
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The opt-out disables SAM registration without blocking DeepEdit or other configured interactive models. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
please take look into new version of monailabel: https://github.com/Project-MONAI/MONAILabel/tree/1.0 LinkedIn Post: https://lnkd.in/p/esPWFJjh |
Fixes #1898.
The per-app
-c sam2 falseworkaround exists, but there is no server-wide wayto skip SAM/SAM2 download and initialization. This PR adds a global setting:
MONAI_LABEL_SKIP_SAMsetting inmonailabel/config.py(env var
MONAI_LABEL_SKIP_SAM, also settable via.env), defaultFalse.is_sam2_module_available()inmonailabel/sam2/utils.pynow returnsFalsewhen the flag is on, so no SAM weights are downloaded or initialized.Since every sample app already gates SAM loading on
is_sam2_module_available(), this one change covers radiology, pathology,endoscopy, and monaibundle with no per-app edits, and the existing per-app
-c sam2 falsekeeps working.Usage:
MONAI_LABEL_SKIP_SAM=True monailabel start_server --app apps/radiology ...Default behavior is unchanged (
False).Summary by CodeRabbit
MONAI_LABEL_SKIP_SAMsetting, configurable through an environment variable and disabled by default. When enabled, MONAI Label reports SAM2 as unavailable without checking for its optional dependency. Existing dependency checks remain unchanged when the setting is disabled.