Model Mask Generator (Tensor Prism)
Point at the region, get a merge mask
- reference_model
- mask
A mask merge is the precision instrument of checkpoint merging: instead of a single ratio, you hand the merge a 0-to-1 map over the weights that says "take everything from A here, everything from B there, blend in between." The catch is building that map. Model Mask Generator (Tensor Prism) is the node that does it from a description: give it a reference model to know the architecture, pick a mask type, and it produces the MASK for you.
It sits at the front of the pack's mask pipeline - generate here, optionally filter with Model Key Filter, blend with Mask Blender, and finally apply with Weighted Mask Merge. If you've ever wanted "take the shallow layers from A, the deep layers from B," this is where that idea starts.
How it works
Connect reference_model (a MODEL, needed so the generator knows the block layout) and pick mask_type from seven:
layer_based- a range of layers vialayer_start/layer_end(defaults 0 and -1 = all).block_based- masks by block region.attention_only/feedforward_only- restrict the mask to attention or MLP weights, exactly as named.custom_pattern- your own key pattern (defaultattn,mlp.fc1).random_sparse- randomly picks a fraction of weights, controlled bysparsity(0.5).depth_gradient- a smooth gradient across depth, withgradient_direction(shallow_to_deep, deep_to_shallow, center_out, edges_in) andfalloff(0.1) controlling the shape. This is the "fade from A to B through the network" option, and it's the one that makes merges feel intentional.
intensity (0–1, default 1) scales the whole mask's values. The single output is mask (MASK).
The workflow
The classic first attempt: depth_gradient with shallow_to_deep, so early layers (composition/structure) come from A and deep layers (fine detail) from B. Then route the mask into Mask Blender if you want to combine it with an attention_only mask, and feed the result to Weighted Mask Merge. That three-node chain is the pack's flagship mask pattern.
Installing it
Part of ComfyUI-Tensor-Prism-Node-Pack. ComfyUI Manager → search "Tensor Prism" → Install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/AstrionX/ComfyUI-Tensor-Prism-Node-Pack
No model downloads; deps are torch, numpy, psutil. Ignore the typo'd clone URL in the README.
The honest caveat
The generator needs a reference_model to know the architecture, so the mask you get is only as meaningful as that model - build it on the wrong family and the layer indices won't line up with the models you actually merge. And this is a first-time author's "vibe-coded" pack with no community track record, so treat layer_based indices as guesses until you verify them on your own models. The depth-gradient and component masks are the safe, well-defined ones; the layer-index and random ones are where you should expect to iterate.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_type | COMBO | 7 options: layer_based, block_based, attention_only, feedforward_only, custom_pattern, random_sparse, +1 | |
| intensity | FLOAT | 1.000–1 | — |
| reference_model | MODEL | — | |
| layer_startopt | INT | 00–50 | — |
| layer_endopt | INT | -1-1–50 | — |
| gradient_directionopt | COMBO | 4 options: shallow_to_deep, deep_to_shallow, center_out, edges_in | |
| sparsityopt | FLOAT | 0.500–1 | — |
| custom_patternopt | STRING | attn,mlp.fc1 | — |
| falloffopt | FLOAT | 0.100–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |