Nodes/Realtime LoRA Trainer/SD 1.5 Model Layer Editor
ComfyUI Node

SD 1.5 Model Layer Editor

Scale the UNet's blocks before any LoRA is applied

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
SD 1.5 Model Layer Editor
  • model
  • model
  • analysis
  • analysis_json
presetDefault
input_0true
input_0_str1.00
input_1true
input_1_str1.00
input_2true
input_2_str1.00
input_3true
input_3_str1.00
input_4true
input_4_str1.00
input_5true
input_5_str1.00
input_6true
input_6_str1.00
input_7true
input_7_str1.00
input_8true
input_8_str1.00
input_9true
input_9_str1.00
input_10true
input_10_str1.00
input_11true
input_11_str1.00
midtrue
mid_str1.00
output_0true
output_0_str1.00
output_1true
output_1_str1.00
output_2true
output_2_str1.00
output_3true
output_3_str1.00
output_4true
output_4_str1.00
output_5true
output_5_str1.00
output_6true
output_6_str1.00
output_7true
output_7_str1.00
output_8true
output_8_str1.00
output_9true
output_9_str1.00
output_10true
output_10_str1.00
output_11true
output_11_str1.00
othertrue
other_str1.00
save_preset_name
delete_preset_name
browser_presets_json{}
save_modelfalse
save_path
save_filename
source_model_path

SD 1.5's UNet is small and well understood - 12 input blocks, a mid block, 12 output blocks - which makes it a genuinely approachable target for block-level editing rather than something you need a huge analysis dashboard to reason about. This node scales each one independently, on the base checkpoint, before any LoRA touches it.

What it is and why you'd reach for it

This edits the model itself, not a LoRA's weights - every one of SD 1.5's 26 tracked block groups (12 input, mid, 12 output, plus a catch-all) gets its own -2 to 2 strength multiplier, with 1.0 unchanged. Because it operates upstream of the LoRA loader, a LoRA applied afterward is patching your already-adjusted base model rather than the two competing for the same weights. It's one of six model layer editors in ShootTheSound/comfyUI-Realtime-Lora, one per architecture the pack covers.

SD 1.5's UNet architecture is the oldest and most-documented in this pack's lineup - the standard "early input blocks handle structure, mid block handles high-level composition, late output blocks handle fine detail" intuition that underlies a lot of classic ControlNet and IP-Adapter block-targeting advice applies here directly, which makes this node a reasonable place to experiment if you've never touched block-level editing before and want a model small enough to hold the whole picture in your head.

Inputs and outputs that matter

  • model - the SD 1.5 checkpoint to edit.
  • preset - Default, All Off, Half Strength, or Custom for hand-tuning.
  • input_0 through input_11 (12 encoder blocks), mid (the bottleneck), output_0 through output_11 (12 decoder blocks), plus other for anything outside the named set - each with its own toggle and a -2 to 2 strength slider.
  • save_preset_name / delete_preset_name (optional) - save a configuration you like under a name, or remove one.
  • save_model / save_path / save_filename (optional) - export the edited checkpoint as a standalone .safetensors file.
  • source_model_path (optional) - points the save operation at the original checkpoint's location.
  • Outputs: model (patched, feed to your sampler or a LoRA loader downstream), analysis (text summary), analysis_json (structured data for chaining).

Installing it

ComfyUI Manager: search "Realtime LoRA Trainer." Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ShootTheSound/comfyUI-Realtime-Lora

Restart ComfyUI. No further install needed - model layer editors work immediately, same as the pack's loaders and analyzers.

Troubleshooting

Set a block to 0 hoping for a clean "off" and got garbage instead. Zero is a much harder edit than it sounds - a strength that low can break the residual connections a UNet block relies on rather than cleanly removing its contribution. Stay closer to the 0.5-1.5 range unless you're deliberately breaking something to see what happens.

Put this after your LoRA loader and results got weird. This is meant to sit upstream - edit the base model, then let a LoRA patch on top of the edited version. Downstream of a LoRA loader, you're scaling the LoRA's own already-applied weights unevenly instead of the base checkpoint, which behaves very differently from what the block guide describes.

Edits that worked on one SD 1.5 checkpoint do nothing useful on another. SD 1.5 fine-tunes vary a lot in how their weight is distributed across blocks depending on what and how heavily they were trained - a mid-block edit that fixed a composition issue on one checkpoint isn't guaranteed to transfer to a differently-trained one. Treat any specific block value as a starting point per checkpoint, not a universal setting.

Categorymodel

Inputs (61)

NameTypeDefaultDescription
modelMODELModel from LoadCheckpoint or LoadDiffusionModel
presetCOMBODefaultQuick preset selection. Individual controls below override when changed.
input_0BOOLEANtrue
input_0_strFLOAT1.00-2–2
input_1BOOLEANtrue
input_1_strFLOAT1.00-2–2
input_2BOOLEANtrue
input_2_strFLOAT1.00-2–2
input_3BOOLEANtrue
input_3_strFLOAT1.00-2–2
input_4BOOLEANtrue
input_4_strFLOAT1.00-2–2
input_5BOOLEANtrue
input_5_strFLOAT1.00-2–2
input_6BOOLEANtrue
input_6_strFLOAT1.00-2–2
input_7BOOLEANtrue
input_7_strFLOAT1.00-2–2
input_8BOOLEANtrue
input_8_strFLOAT1.00-2–2
input_9BOOLEANtrue
input_9_strFLOAT1.00-2–2
input_10BOOLEANtrue
input_10_strFLOAT1.00-2–2
input_11BOOLEANtrue
input_11_strFLOAT1.00-2–2
midBOOLEANtrue
mid_strFLOAT1.00-2–2
output_0BOOLEANtrue
output_0_strFLOAT1.00-2–2
output_1BOOLEANtrue
output_1_strFLOAT1.00-2–2
output_2BOOLEANtrue
output_2_strFLOAT1.00-2–2
output_3BOOLEANtrue
output_3_strFLOAT1.00-2–2
output_4BOOLEANtrue
output_4_strFLOAT1.00-2–2
output_5BOOLEANtrue
output_5_strFLOAT1.00-2–2
output_6BOOLEANtrue
output_6_strFLOAT1.00-2–2
output_7BOOLEANtrue
output_7_strFLOAT1.00-2–2
output_8BOOLEANtrue
output_8_strFLOAT1.00-2–2
output_9BOOLEANtrue
output_9_strFLOAT1.00-2–2
output_10BOOLEANtrue
output_10_strFLOAT1.00-2–2
output_11BOOLEANtrue
output_11_strFLOAT1.00-2–2
otherBOOLEANtrue
other_strFLOAT1.00-2–2
save_preset_nameoptSTRINGEnter preset name, then click Save Preset button (or leave for file sync on execute)
delete_preset_nameoptSTRINGPreset to delete (filled automatically by Delete button)
browser_presets_jsonoptSTRING{}JSON of all browser presets (auto-filled by JS for sync)
save_modeloptBOOLEANfalseSave modified model to disk (large files!)
save_pathoptSTRINGDirectory to save modified model
save_filenameoptSTRINGFilename for saved model (timestamp added)
source_model_pathoptSTRINGPath to original model file (for copying metadata). Required for saved model to load correctly.

Outputs (3)

NameTypeDescription
modelMODELModel with block modifications applied
analysisSTRINGText analysis of model structure
analysis_jsonSTRINGJSON analysis data