fix(correction): step-based progress and multi-channel latent support

replace hardcoded timestep thresholds with step-based progress percentages
so corrections work with flow-match schedulers (Flux 2, etc.)
adapt brightness, color and tint corrections for multi-channel latents:
- brightness uses multiplicative scaling instead of additive offset
- color applies to all channels instead of skipping channel 0
- tint falls back to uniform offset when TAESD encoding is unavailable
pass step parameter through correction_callback for progress calculation
This commit is contained in:
CalamitousFelicitousness
2026-03-19 04:03:13 +00:00
parent ee2fc75619
commit 423c3ef8b7
2 changed files with 61 additions and 18 deletions
+2 -2
View File
@@ -40,7 +40,7 @@ def diffusers_callback_legacy(step: int, timestep: int, latents: torch.FloatTens
latents = torch.from_numpy(latents)
shared.state.sampling_step = step
shared.state.current_latent = latents
latents = processing_correction.correction_callback(p, timestep, {'latents': latents})
latents = processing_correction.correction_callback(p, timestep, {'latents': latents}, step=step)
if shared.state.interrupted or shared.state.skipped:
raise AssertionError('Interrupted...')
if shared.state.paused:
@@ -93,7 +93,7 @@ def diffusers_callback(pipe, step: int = 0, timestep: int = 0, kwargs: dict = No
debug_callback(f"Callback: IP Adapter scales={ip_adapter_scales}")
pipe.set_ip_adapter_scale(ip_adapter_scales)
if step != getattr(pipe, 'num_timesteps', 0):
kwargs = processing_correction.correction_callback(p, timestep, kwargs, pipe=pipe, initial=step == 0)
kwargs = processing_correction.correction_callback(p, timestep, kwargs, pipe=pipe, initial=step == 0, step=step)
kwargs = prompt_callback(step, kwargs) # monkey patch for diffusers callback issues
if step == 0: