Nodes/Realtime LoRA Trainer/Z-Image Model Layer Editor
ComfyUI Node

Z-Image Model Layer Editor

Scale the base model's layers before any LoRA touches it

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
Z-Image Model Layer Editor
  • model
  • model
  • analysis
  • analysis_json
presetDefault
layer_0true
layer_0_str1.00
layer_1true
layer_1_str1.00
layer_2true
layer_2_str1.00
layer_3true
layer_3_str1.00
layer_4true
layer_4_str1.00
layer_5true
layer_5_str1.00
layer_6true
layer_6_str1.00
layer_7true
layer_7_str1.00
layer_8true
layer_8_str1.00
layer_9true
layer_9_str1.00
layer_10true
layer_10_str1.00
layer_11true
layer_11_str1.00
layer_12true
layer_12_str1.00
layer_13true
layer_13_str1.00
layer_14true
layer_14_str1.00
layer_15true
layer_15_str1.00
layer_16true
layer_16_str1.00
layer_17true
layer_17_str1.00
layer_18true
layer_18_str1.00
layer_19true
layer_19_str1.00
layer_20true
layer_20_str1.00
layer_21true
layer_21_str1.00
layer_22true
layer_22_str1.00
layer_23true
layer_23_str1.00
layer_24true
layer_24_str1.00
layer_25true
layer_25_str1.00
layer_26true
layer_26_str1.00
layer_27true
layer_27_str1.00
layer_28true
layer_28_str1.00
layer_29true
layer_29_str1.00
othertrue
other_str1.00
save_preset_name
delete_preset_name
browser_presets_json{}
save_modelfalse
save_path
save_filename
source_model_path

Every other node in this pack that fiddles with blocks is doing it to a LoRA. This one is different: it edits the base checkpoint's 30 layers directly, before any LoRA is applied - turning down a layer that's biasing your output, or boosting one that's underperforming, as a permanent adjustment to the model itself rather than something a LoRA has to fight against.

What it is and why you'd reach for it

Z-Image's DiT has 30 layers, and this node scales each one's contribution independently - a strength multiplier between -2 and 2, with 1.0 meaning unchanged. The pack's own author has posted community findings on exactly this kind of layer analysis: in one documented case, an anatomical feature a user was training turned out to concentrate in layers 17-21, not the layers they expected, which is the whole reason a tool like this exists instead of guessing. Community testing elsewhere has similarly found Z-Image character likeness sitting in a fairly narrow late-layer band (roughly 18-28) with a lot of the style signal in weights outside the numbered layers entirely - which is why this node, like the pack's LoRA loaders, has a catch-all other slider alongside the 30 numbered ones.

This is base-model editing, not LoRA editing - you use it upstream of a LoRA loader, so whatever a LoRA does afterward is applying on top of your adjusted model rather than the two competing.

How it works

The pack groups Z-Image's 30 layers into rough zones: layers 0-9 handle early processing (structure), 10-19 mid processing (features), 20-29 late processing (details) - a coarser version of the finer sub-component breakdown the pack's separate DIT Deep Debiaser node offers for the same model, if block-level turns out not to be granular enough.

Inputs and outputs that matter

  • model - the Z-Image checkpoint to edit.
  • preset - Default, All Off, Half Strength, Late Only (20-29), Mid-Late (15-29), or Custom for hand-tuning individual layers.
  • layer_0 through layer_29, each with a toggle and a -2 to 2 strength slider, plus other for weights outside the 30 named layers.
  • save_preset_name / delete_preset_name (optional) - save your own toggle configuration under a name, or delete a saved one, so a combination you like doesn't have to be rebuilt from scratch next session.
  • save_model / save_path / save_filename (optional) - export the edited checkpoint to disk as its own .safetensors file.
  • source_model_path (optional) - a way to specify the original model's path for the save operation.
  • 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 extra install needed - model layer editors work out of the box like the pack's LoRA loaders and analyzers.

Troubleshooting

Set a layer to 0 strength and got noise instead of "no contribution." Zeroing out a layer entirely is more disruptive than a subtle edit - the pack's own debiaser nodes carry an explicit warning that 0.0 tends to produce artifacts rather than a clean absence, and the same caution applies here. Work in the 0.5-1.5 range for adjustments; save the extremes for deliberate experiments.

Edited the model but a LoRA applied afterward doesn't reflect the change. Order matters - this node needs to sit before your LoRA loader in the graph, editing the base model that the LoRA then patches on top of. If it's downstream of the LoRA instead, you're scaling the LoRA-modified model, which is a different (and less predictable) operation than what the block guide describes.

Trying to reproduce someone else's layer edit and it doesn't do the same thing. Presets and hand-tuned layer values are checkpoint-specific - the "18-28 controls likeness" pattern is a community observation on typical Z-Image behavior, not a universal constant, and a fine-tune or merge can shift where things land.

Categorymodel

Inputs (71)

NameTypeDefaultDescription
modelMODELModel from LoadCheckpoint or LoadDiffusionModel
presetCOMBODefaultQuick preset selection. Individual controls below override when changed.
layer_0BOOLEANtrue
layer_0_strFLOAT1.00-2–2
layer_1BOOLEANtrue
layer_1_strFLOAT1.00-2–2
layer_2BOOLEANtrue
layer_2_strFLOAT1.00-2–2
layer_3BOOLEANtrue
layer_3_strFLOAT1.00-2–2
layer_4BOOLEANtrue
layer_4_strFLOAT1.00-2–2
layer_5BOOLEANtrue
layer_5_strFLOAT1.00-2–2
layer_6BOOLEANtrue
layer_6_strFLOAT1.00-2–2
layer_7BOOLEANtrue
layer_7_strFLOAT1.00-2–2
layer_8BOOLEANtrue
layer_8_strFLOAT1.00-2–2
layer_9BOOLEANtrue
layer_9_strFLOAT1.00-2–2
layer_10BOOLEANtrue
layer_10_strFLOAT1.00-2–2
layer_11BOOLEANtrue
layer_11_strFLOAT1.00-2–2
layer_12BOOLEANtrue
layer_12_strFLOAT1.00-2–2
layer_13BOOLEANtrue
layer_13_strFLOAT1.00-2–2
layer_14BOOLEANtrue
layer_14_strFLOAT1.00-2–2
layer_15BOOLEANtrue
layer_15_strFLOAT1.00-2–2
layer_16BOOLEANtrue
layer_16_strFLOAT1.00-2–2
layer_17BOOLEANtrue
layer_17_strFLOAT1.00-2–2
layer_18BOOLEANtrue
layer_18_strFLOAT1.00-2–2
layer_19BOOLEANtrue
layer_19_strFLOAT1.00-2–2
layer_20BOOLEANtrue
layer_20_strFLOAT1.00-2–2
layer_21BOOLEANtrue
layer_21_strFLOAT1.00-2–2
layer_22BOOLEANtrue
layer_22_strFLOAT1.00-2–2
layer_23BOOLEANtrue
layer_23_strFLOAT1.00-2–2
layer_24BOOLEANtrue
layer_24_strFLOAT1.00-2–2
layer_25BOOLEANtrue
layer_25_strFLOAT1.00-2–2
layer_26BOOLEANtrue
layer_26_strFLOAT1.00-2–2
layer_27BOOLEANtrue
layer_27_strFLOAT1.00-2–2
layer_28BOOLEANtrue
layer_28_strFLOAT1.00-2–2
layer_29BOOLEANtrue
layer_29_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