π° Get Model Blocks - v1 /m
The block-weight cheat sheet β find the exact key names for model surgery
- model
- BLOCKS
- NAMES
- BLOCKS WEIGTHS
- COUNT
Block-weight manipulation - multiplying or reshaping specific layers of a diffusion model to change its style - is one of those dark-arts workflows where half the battle is just knowing the names of the blocks. Model state dicts are thousands of keys deep, and typing one wrong name means the whole thing silently does nothing. Get Model Blocks exists to end that guesswork: give it your MODEL and it reads the state dict, extracts every block name, and hands you the list as text you can copy straight into a block-weight tool.
It's the companion to the pack's "BlockBuster"-style workflow (the README shows it driving model-weight modification images). It's also what Display Any uses under the hood to show model internals on screen.
How it works
It scans model.model_state_dict() and pulls out every block-ish key via a regex that matches patterns like name.name.N or name.name[N] - e.g. transformer_blocks.0 or input_blocks.3. The diffusion_model. prefix is stripped for readability. Then it sorts the unique names, dedupes, and returns them.
Two modes via the type dropdown:
- Names - just the block names, one per line. The starter pack.
- Variations - generates the weighted names at every step from 0.1 up to your
variationvalue (default 1.4), e.g.transformer_blocks.0=0.1,=0.2, β¦=1.4. That's the format for block-weight nodes that want explicit per-block weights, ready to paste.
Inputs: model (MODEL), type (Names/Variations), variation (FLOAT, max weight step for Variations mode). Outputs: BLOCKS (the weight strings), NAMES (clean names), BLOCKS WEIGTHS (names with a %WEIGHT% placeholder), COUNT (INT, how many blocks).
Using it
Wire your loaded checkpoint in, choose Names, and read the output in a Display node - then paste the block names into whatever weight-modifier you're using. The Variations output is the gift: it generates the exact block=weight syntax so you don't hand-write fifty lines. The BLOCKS WEIGTHS output with %WEIGHT% placeholders is for tools that want you to fill in the value yourself.
Installing it
Ships in the MaraScott pack: ComfyUI Manager β search "MaraScott" β Install β restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/MaraScott/ComfyUI_MaraScott_Nodes
Then restart. The pack pulls in opencv-python, numba, blend_modes and a pinned transformers==4.37.2; this node itself only needs ComfyUI core.
Common issues
The regex-based extraction is opinionated: it only catches keys matching the word.word.digit pattern, so unusual block layouts or custom architectures may return a short list - if COUNT looks too small, your model's naming just isn't in the expected format, and you'll need the raw state-dict keys from elsewhere. Also note it only extracts keys containing "block" in the name, so non-block keys (like embedding layers) are intentionally absent. If you're on an exotic model and get an empty result, that's the model, not a broken node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | β | |
| type | COMBO | Names | 2 options: Names, Variations |
| variation | FLOAT | 1.40.1β14 | β |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| BLOCKS | STRING | β |
| NAMES | STRING | β |
| BLOCKS WEIGTHS | STRING | β |
| COUNT | INT | β |