Nodes/ComfyUI-TBG-SAM3/TBG SAM3 Model Loader
ComfyUI Node

TBG SAM3 Model Loader

The one-input SAM3 loader that starts every TBG-SAM3 workflow

By Ltamann·Created 10 months ago·Updated about a month ago· 169
TBG SAM3 Model Loader
    • SAM3_MODEL
    devicecuda

    Every workflow in the TBG-SAM3 pack starts at the same unglamorous place: TBG SAM3 Model Loader. One input, one output, nothing to fiddle with - and yet it's the node that stops more people than anything else here, because SAM3 is not a model you just download. It's a Meta checkpoint sitting behind a gated Hugging Face repo, and this loader is how you get it into the graph.

    What it actually is

    This is the simplest of the pack's two loaders. It builds Meta's Segment Anything Model 3 image model from the sam3 library the pack vendors, wraps it in SAM3's processor, and pushes it to whatever device you pick. You feed its single SAM3_MODEL output into TBG SAM3 Segmentation or TBG SAM3 Batch Selector and you're done. There's no settings file, no dropdown of checkpoints, no "which variant" question - because SAM3 image mode is one model, not a menu.

    Don't mistake "simple" for "free". Under the hood the loader calls the model builder with Hugging Face downloading enabled, which means the first run pulls sam3.pt from facebook/sam3 into your HF cache. The advanced loader in this pack gives you control over where that checkpoint lands; this one just quietly fetches and caches it.

    The inputs and output

    There's exactly one input that matters:

    • device - cuda by default, cpu if you're running on a machine without a working GPU. The README sells SAM3 as "efficient usage of available GPU or fallback to CPU", and it does work on CPU, it's just slow. If ComfyUI reports the loader as missing entirely, the cause is almost never this dropdown.

    Output is a single SAM3_MODEL, which is the pack's internal model+processor+device bundle. Wire it into the segmentation nodes' sam3_model input. Nothing else in ComfyUI accepts this type, so don't plan on reusing it outside the pack.

    Installing and getting the model to load

    ComfyUI Manager handles the pack itself: search "TBG-SAM3" and install. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Ltamann/ComfyUI-TBG-SAM3
    cd ComfyUI-TBG-SAM3
    pip install -r requirements.txt
    

    That gets the code. Getting the model is the part people miss. The SAM3 checkpoint is gated:

    1. Go to huggingface.co/facebook/sam3, click Request Access, and wait for approval (the README says up to 24 hours - plan around it).
    2. Create a read-access token and expose it to ComfyUI before starting it:
    export HF_TOKEN="your_token"
    
    1. Restart ComfyUI and load the node. First run downloads the multi-gigabyte checkpoint, so give it a while before assuming it hung.

    Where people get burned

    • The sam3 Python package isn't installed. The pack's install.py clones facebookresearch/sam3 and installs it editable with --no-deps; if nodes show up but the loader errors out, re-run python install.py inside the pack folder. The pack warns loudly about this in its console output at startup.
    • The model is gated and you skipped the token. You'll get a 401 from Hugging Face. There's no way around the access request - it's Meta's call, not the pack's.
    • A slow first load. SAM3 is a large transformer; loading it plus TF32 setup takes a minute even on decent GPUs. Watch the console for the [SAM3] logs rather than assuming the graph froze.

    If you want the checkpoint in ComfyUI/models/sam3/sam3.pt so it's visible and reusable across other SAM3 packs, use the TBG SAM3 Model Loader and Downloader instead - this loader caches to HF and keeps the file out of sight. For everything else, the one-input loader is the one you'll reach for daily.

    CategoryTBG/SAM3

    Inputs (1)

    NameTypeDefaultDescription
    deviceCOMBOcuda2 options: cuda, cpu

    Outputs (1)

    NameTypeDescription
    SAM3_MODELSAM3_MODEL