Nodes/LoRA Power-Merger ComfyUI/PM LoRA Block Sampler
ComfyUI Node

PM LoRA Block Sampler

See which blocks of a LoRA actually matter — round-robin block sampling

By larsupb·Created 2 years ago·Updated 29 days ago· 75
PM LoRA Block Sampler
  • noise
  • guider
  • sampler
  • sigmas
  • latent_image
  • lora
  • vae
  • model
  • latents
  • image_grid
bock_sampling_mode
image_display

This node answers a question most people never ask but really should: which blocks of your LoRA are doing the work? It samples the same image repeatedly, each time applying the LoRA's patches to a different subset of blocks, and shows you the effect in a grid. Some LoRAs are all about the attention blocks; others carry their identity in the middle block. Knowing which is which tells you what a merge or a block-weight tweak will actually change.

It's the investigative sibling of the Stack Sampler. That one compares LoRAs against each other; this one dissects a single LoRA layer by layer. If you've ever used PM LoRA Modifier to scale specific blocks and wondered whether the scaling did anything, this is how you check.

How it works

You feed it a LoRABundle plus the full sampling rig. It walks through the LoRA's blocks in round-robin fashion, and for each pass applies the patches to a different block slice. The mode decides the framing:

  • round_robin_exclude - each sample has one group of blocks excluded, showing what that block contributes by its absence.
  • round_robin_include - each sample has one group of blocks included, showing what that block alone does.

The image_display setting picks between showing the actual generated image or image_diff - the pixel difference against a base image, which makes subtle block contributions visible that the plain render hides. Previews run live during sampling (fixed in 2.3.0), so you're not staring at a blank progress bar.

The inputs that matter

  • noise, guider, sampler, sigmas, latent_image - the standard sampling rig.
  • model and vae - the model to patch and the VAE for decoding.
  • lora - the LoRABundle to dissect.
  • bock_sampling_mode - yes, that typo is in the code; it's the include/exclude mode above.
  • image_display - image or image_diff.

Outputs: latents and an image_grid for comparison.

Installing

Ships in the LoRA Power-Merger pack. ComfyUI Manager (search "LoRA Power-Merger") or:

cd ComfyUI/custom_nodes
git clone https://github.com/larsupb/LoRA-Merger-ComfyUI
cd LoRA-Merger-ComfyUI
pip install -r requirements.txt

Restart ComfyUI. Dependencies: PyTorch, lxml, mergekit.

Common issues

Two things to know going in. First, it's a multi-sample node - a LoRA with a dozen block groups means a dozen samples, so budget the runtime like you would a batch. Second, if your decoded images look washed out or like weird diffs, you're on an old version: 2.3.0 fixed exactly that (the denoised latent is now passed through the model's latent processing before VAE decode, and latents are combined correctly). Update the pack if you see it. And image_diff is the mode that needs a base reference - if the diff looks meaningless, confirm you understand which sample is the baseline.

CategoryLoRA PowerMerge/sampling

Inputs (10)

NameTypeDefaultDescription
noiseNOISE
guiderGUIDER
samplerSAMPLER
sigmasSIGMAS
latent_imageLATENT
loraLoRABundle
vaeVAE
modelMODEL
bock_sampling_modeCOMBO2 options: round_robin_exclude, round_robin_include
image_displayCOMBO2 options: image, image_diff

Outputs (2)

NameTypeDescription
latentsLATENT
image_gridIMAGE