Model Change Device
Relocate Your Pipeline's Big Objects to a Specific GPU (or Off It)
- sam_model
- grounding_dino_model
- model
- clip
- vae
- pipeline
- control_net
- trigger_condition_image
- trigger_condition_mask
- trigger_condition_latent
This is the model-level sibling of Image Change Device and Mask Change Device - same idea, bigger objects. Instead of relocating an image or mask tensor, it moves the heavy pipeline components: the main diffusion model, CLIP, VAE, a ControlNet, a SAM model, a GroundingDINO model, or a generic "pipeline" object some custom nodes pass around as a bundle. If you've ever wanted to explicitly push one of those onto CPU to free VRAM, or onto a second GPU to spread load, this is the node for it.
There's one required input, device, the same five-choice dropdown you'll see across this pack (default, cpu, cuda, cuda:0, cuda:1). Everything else is optional - sam_model, grounding_dino_model, model, clip, vae, pipeline, and control_net - and you only need to plug in whichever ones you actually want relocated; anything left unconnected is simply untouched. The sam_model/grounding_dino_model pair is a strong hint about the workflows this was built for: SAM plus GroundingDINO is the standard combo for text-prompted segmentation ("find and mask the thing described by this text"), the same family of detector this ecosystem's detect-crop-refine tools (like Impact Pack's SAM detector provider) lean on - so if you're running that kind of pipeline and want the detector models parked somewhere specific, this node covers it in the same place it covers your main model and VAE.
There's also a set of trigger_condition_* inputs - image, mask, latent, text, seed - that don't get moved or transformed by this node at all. Reading the schema, the most plausible reason they exist is execution control: this node has no outputs of its own, which normally means ComfyUI could skip running it if nothing depends on it. It's explicitly flagged so it always executes regardless - and the trigger inputs look like they're there so you can wire something meaningful through them (a seed, a piece of text) to tie this node's execution into your graph's dependency chain. Take that as an informed reading of the node's shape rather than a documented fact - there's no README to confirm it either way.
Installing it: comfyui-mask-util comes from longgui0318, whose better-known project is comfyui-magic-clothing, a virtual-try-on wrapper that had a short burst of Reddit interest in 2024 and has gone quiet since. Mask-util reads as the leftover device/dtype/crop plumbing from building that. The GitHub README is just the repo title - no install guide, no usage notes - so everything above comes from the node's own definition, not documentation.
Install through ComfyUI Manager (search "comfyui-mask-util") or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/longgui0318/comfyui-mask-util
Restart ComfyUI afterward. No model downloads for the node itself - it moves models you already have loaded, it doesn't fetch new ones.
Where it bites: relocating a large model to cpu and back is not free - it's a real transfer over PCIe and, for a full diffusion model, can take noticeably longer than the equivalent image or mask move. Requesting a cuda:1 that doesn't exist on your machine will error rather than silently fall back to whatever GPU you do have. And because this node has no outputs, if it isn't actually wired into your graph's data flow at all (no trigger inputs connected either), double-check it's still being executed the way you expect - an unconnected node with no consumers is exactly the situation the is_output_node flag exists to override, but it's worth confirming rather than assuming.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| device | COMBO | 5 options: default, cpu, cuda, cuda:0, cuda:1 | |
| sam_modelopt | SAM_MODEL | — | |
| grounding_dino_modelopt | GROUNDING_DINO_MODEL | — | |
| modelopt | MODEL | — | |
| clipopt | CLIP | — | |
| vaeopt | VAE | — | |
| pipelineopt | PIPELINE | — | |
| control_netopt | CONTROL_NET | — | |
| trigger_condition_imageopt | IMAGE | — | |
| trigger_condition_maskopt | MASK | — | |
| trigger_condition_latentopt | LATENT | — | |
| trigger_condition_textopt | STRING | — | |
| trigger_condition_seedopt | INT | 0 | — |
Outputs (0)
No outputs