mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user