SAMModel Passthrough
A clean lane for the Segment Anything model
- sam_model
- sam_model
SAM - Meta's Segment Anything Model - is the promptable segmenter: give it a point, a box, or (from SAM 3) a text phrase, and it produces a precise mask. The object ComfyUI carries around for that is the SAM_MODEL, a loaded model object that segmentation nodes consume. The SAMModel Passthrough is the usual one-socket-in, one-socket-out relay for it: carry the model from its loader to wherever segmentation actually happens, without a heavy wire stretched across the graph.
It matters in the segment-then-detail pipelines that dominate fixing workflows - the ones where a SAM loader feeds a segment node, which produces a mask, which feeds a detailer. Add a subgraph around that region and the SAM model is exactly the kind of value you want entering on an explicit, verifiable wire. There's a real subtlety worth naming: the SAM_MODEL is the model, not the mask. This passthrough carries the model object; the mask comes out of a segment node downstream. People occasionally mix the two up, and the node won't correct you - it just relays whatever it's handed.
How it works
Generated from the same simple-passthrough controller as the rest of the pack: the run function is return (kwargs.get("sam_model"),). Read it, hand it back unchanged. Two behaviors to know:
- Unconnected means
None. Empty socket, or muted/bypassed upstream, and the output isNone. - Connect-only. The model has to come from a SAM loader (Impact Pack and similar packs provide them) - no widget, and you can't conjure a SAM model from thin air.
Inputs and outputs
sam_model(SAM_MODEL) in →sam_model(SAM_MODEL) out.
One pair. Output feeds any SAM_MODEL socket on a segment node. Under Tojioo Passthrough → Simple Passthrough.
Install
Manager → search "Tojioo Passthrough" → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Tojioo/tojioo_passthrough.git
No model files to download and no extra pip packages - note that the SAM weights themselves come from your SAM loader of choice, not from this pack. Small single-maintainer pack, GPL-3.0.
Common issues
The None handoff is the usual suspect: mute the SAM loader upstream and the segment node downstream quietly has no model. And because SAM_MODEL sockets come from packs like Impact Pack, make sure you've actually got a SAM loader installed that produces this type - this passthrough won't fetch weights or create a model for you. If a segment node complains about a missing model, trace the wire back past this relay and check the loader.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| sam_modelopt | SAM_MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| sam_model | SAM_MODEL | — |