Layer Adjustments - Enferlain/sd-optim GitHub Wiki
Layer Adjustments (Informational)
(Note: The layer_adjust
optimization mode requires specific setup and its integration with the current sd-mecha backend may need further review. This page primarily describes the parameters.)
The layer_adjustments
component in optimization_guide.yaml
allows for fine-tuning specific layers, primarily affecting color, contrast, and detail. These parameters are typically applied after a model is loaded, modifying its weights directly before generation.
When optimization_mode: layer_adjust
is selected in config.yaml
, the optimizer will tune these parameters based on the image scores.
Parameters
These parameters correspond to those used in tools like SuperMerger.
- Detail Adjustments: Applied multiplicatively to specific input/output blocks.
detail1
: (IN Blocks - Detail/Noise) Affects early processing stages. Positive values decrease initial detail; negative values increase it. Recommended range:[-6, 6]
.detail2
: (OUT Blocks - Detail/Noise) Affects the final output layers. Positive values decrease output detail; negative values increase it. Recommended range:[-6, 6]
.
- Combined Adjustments: Applied additively to the
model.diffusion_model.out.2
layer weights/biases.detail3
: (OUT2 Blocks - Detail/Noise) Further detail adjustment at a late stage. Recommended range:[-6, 6]
.contrast
: Influences overall contrast and detail. Recommended range:[-10, 10]
.brightness
: Affects overall brightness (Negative=Darker, Positive=Brighter). Recommended range:[-10, 10]
.col1
: Color balance (Negative=Cyan-ish, Positive=Red-ish). Recommended range:[-10, 10]
.col2
: Color balance (Negative=Magenta-ish, Positive=Green-ish). Recommended range:[-10, 10]
.col3
: Color balance (Negative=Yellow-ish, Positive=Blue-ish). Recommended range:[-10, 10]
.
optimization_guide.yaml
Configuration in components:
- name: layer_adjustments
strategy: all # Optimize all defined parameters individually
# Or use 'select'/'group' if you only want to optimize specific ones
# strategy: select
# keys: [detail1, contrast, brightness]
You can set custom bounds for these parameters using the custom_bounds
section in optimization_guide.yaml
, targeting the parameter names (e.g., detail1: [-3, 3]
).