ComfyUI Node
MD: APG Guider
A ComfyUI node in MD_Nodes/Guidance with 19 inputs and 3 outputs.
MD: APG Guider
- model
- positive
- negative
- apg_guider
- guidance_plot
- config_summary
◄disable_apgfalse►
◄apg_scale4.5►
◄cfg_before4.0►
◄cfg_after3.0►
◄norm_threshold2.5►
◄momentum0.75►
◄start_sigma-1.00►
◄end_sigma-1.00►
◄eta0.0►
◄dims-1, -2►
◄predict_imagetrue►
◄mode▾►
◄yaml_parameters_opt►
◄debug_mode0 - Silent►
◄enable_profilingfalse►
◄verbose_debugfalse►
CategoryMD_Nodes/Guidance
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | MODEL INPUT • Purpose: The diffusion model to apply APG guidance to. • Requirement: Any standard diffusion model (SD1.5, SDXL, Flux). • Processing: Wraps model in custom CFGGuider. | |
| positive | CONDITIONING | POSITIVE COND • Purpose: Your main prompt conditioning (what you want). • Usage: Standard positive prompt input. | |
| negative | CONDITIONING | NEGATIVE COND • Purpose: Negative prompt conditioning (what you avoid). • Trade-off: APG uses this heavily for orthogonal projection math. ⭐ Essential for APG logic. | |
| disable_apg | BOOLEAN | false | DISABLE APG • Purpose: Bypass APG entirely for A/B testing. • Effect: If True, acts as standard CFGGuider. ⭐ Use to compare results without rewiring. |
| apg_scale | FLOAT | 4.50–1000 | APG SCALE • Purpose: Strength of orthogonal correction (how much to fix the path). • Range: 0.0 (Off) to 20.0 (Extreme). • Trade-offs: Higher values enforce prompt adherence but may 'burn' the image. • Recommended: 3.0 - 6.0. ⭐ Start with 4.5 for balanced results. |
| cfg_before | FLOAT | 4.01–1000 | CFG (BEFORE) • Purpose: Static CFG applied *during* the APG active phase (High Sigma). • Range: 1.0 to 30.0. • Trade-offs: Lower values allow more creativity; higher values enforce strictness. ⭐ Recommended: 4.0 - 7.0. |
| cfg_after | FLOAT | 3.01–1000 | CFG (AFTER) • Purpose: Static CFG applied *after* APG deactivates (Low Sigma). • Range: 1.0 to 30.0. • Trade-offs: Lower values here improve fine details and texture. ⭐ Recommended: 2.0 - 3.5. |
| norm_threshold | FLOAT | 2.50–1000 | NORM THRESHOLD • Purpose: Cap the guidance vector magnitude to prevent artifacts. • Range: 0.0 (No Cap) to 10.0. • Trade-offs: Lower values prevent burning but reduce guidance strength. ⭐ Recommended: 2.5. |
| momentum | FLOAT | 0.75-1000–1000 | MOMENTUM • Purpose: Smooths guidance vectors across steps using a running average. • Range: -1.0 to 1.0. • Effect: Positive values stabilize; negative values oscillate. ⭐ Recommended: 0.5 - 0.75. |
| start_sigma | FLOAT | -1.00-1–10000 | START SIGMA • Purpose: Noise level where APG activates. • Options: -1.0 (Infinity/Always On) or specific sigma (e.g., 15.0). • Logic: Activates when current sigma <= start_sigma. ⭐ Recommended: -1.0 (or match your scheduler's max sigma). |
| end_sigma | FLOAT | -1.00-1–10000 | END SIGMA • Purpose: Noise level where APG deactivates (switching to 'cfg_after'). • Options: -1.0 (Never disable) or specific sigma (e.g., 1.0). • Logic: Deactivates when current sigma < end_sigma. ⭐ Recommended: 1.0 to 3.0 (let the model refine details freely). |
| eta | FLOAT | 0.0-1000–1000 | ETA (DEPRECATED) • Purpose: Legacy parameter from original APG, no longer used in this fork. • Recommendation: Leave at 0.0. |
| dims | STRING | -1, -2 | DIMS • Purpose: Dimensions for normalization and projection. • Format: Comma-separated integers (e.g., '-1, -2'). • Meaning: -1,-2 corresponds to Height/Width spatial dimensions. ⭐ Recommended: '-1, -2'. |
| predict_image | BOOLEAN | true | PREDICT IMAGE • Purpose: Defines target domain for guidance. • Options: True (v-prediction/x0), False (epsilon/noise). • Trade-offs: True usually works better for modern models. ⭐ Recommended: True. |
| mode | COMBO | APG MODE • Purpose: Algorithm variant selection. • Options: - pure_apg: Standard orthogonal projection. - pre_cfg: Applies projection before CFG scaling. - alt1/alt2: Alternative momentum blending strategies. ⭐ Recommended: 'pure_apg'. | |
| yaml_parameters_optopt | STRING | YAML OVERRIDE • Purpose: Define complex multi-stage schedules. • Format: List of dicts with 'start_sigma', 'cfg', 'apg_scale', etc. • Priority: Overrides slider inputs if valid. ⭐ Advanced users only. | |
| debug_modeopt | COMBO | 0 - Silent | LOGGING VERBOSITY • Purpose: Controls console output details. • Options: - 0: Minimal output. - 1: Basic info + Profiler report. - 2: Step-by-step guidance logs. ⭐ Recommended: 0 for production, 1 for tuning. |
| enable_profilingopt | BOOLEAN | false | ENABLE PROFILING • Purpose: Measure timing of rule building and plotting. • Automatic: Enabled if Debug Mode >= 1. ⭐ Recommended: False. |
| verbose_debugopt | BOOLEAN | false | LEGACY VERBOSE • Deprecated. Use 'debug_mode' instead. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| apg_guider | GUIDER | — |
| guidance_plot | IMAGE | — |
| config_summary | STRING | — |