Nodes/SimpleSyrup/SAM Model Loader
ComfyUI Node

SAM Model Loader

The dropdown that can fetch the SAM weights for you

By Artificial-Sweetener·Created 3 months ago·Updated 12 days ago· 2
SAM Model Loader
    • sam_model
    sam_modelsam_vit_b (375MB)

    SAM - Meta's Segment Anything - is the workhorse behind "make a mask that follows the object's outline instead of a rectangle." Impact Pack made SAM a ComfyUI standard with its own SAM loader, and SimpleSyrup.SAMModelLoader plays in the same sandbox: it loads a SAM model and emits the same SAM_MODEL type, so it feeds both SimpleSyrup's SAM nodes and Impact Pack nodes that accept the socket. If you already use Impact Pack's SAMLoader, this is a drop-in alternative that adds one thing: it can download the model for you.

    The single input is sam_model, a dropdown. Default is sam_vit_b (375MB) - the small one, which is the right default. SAM's quality scales with size, but so does memory and latency, and for prompting-based segmentation (you're giving SAM a box from a detector, not asking it to find everything) the base model is plenty. The dropdown also carries sam_vit_l (1.25GB) and sam_vit_h (2.56GB) for when you want the heavy one, plus SAM-HQ variants in the catalog. The size labels are in the names, which is a small courtesy you'll appreciate the first time you wonder which 2.5GB pth you just grabbed.

    The download bit is the pack's signature feature. If you have the setting "Show downloadable models in loader dropdowns" enabled (it's a SimpleSyrup ComfyUI setting), the dropdown lists known models that aren't installed yet. Pick one, and the loader fetches the exact, catalog-pinned file with progress visible in Comfy. With the setting off, the dropdown only shows models you can verify exist locally. Either way, nothing downloads behind your back - the toggle decides whether missing entries even appear.

    Output is a single sam_model socket. Wire it to:

    • Prompt SEGS w/ SAM - where SAM takes detector boxes and turns them into precise masks.
    • SEGS from SAM Output - where SAM does automatic, unprompted segmentation.
    • Any Impact Pack or compatible node that takes a SAM_MODEL.

    Install: the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Artificial-Sweetener/SimpleSyrup
    cd SimpleSyrup && pip install -r requirements.txt
    

    or ComfyUI Manager → search SimpleSyrup → Install → restart. The segment-anything package is in SimpleSyrup's requirements, so SAM support arrives with the pack rather than being a separate install. Keep ComfyUI current (v3 extension API). If the dropdown feels empty, it's almost certainly the "show downloadable models" setting - flip it on, restart, and the catalog entries reappear.

    CategorySimpleSyrup/Masking

    Inputs (1)

    NameTypeDefaultDescription
    sam_modelCOMBOsam_vit_b (375MB)SAM model choice used to create masks from detected boxes.

    Outputs (1)

    NameTypeDescription
    sam_modelSAM_MODELLoaded SAM model for prompt-based mask and SEGS creation.