Skip to content

Commit d6a3988

Browse files
Merge pull request #9669 from catboxanon/patch/sampler-schedule-fix
Fix prompt schedule for second order samplers
2 parents fc6eeda + 9de7298 commit d6a3988

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

modules/processing.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,14 @@ def get_conds_with_caching(function, required_prompts, steps, cache):
642642
processed = Processed(p, [], p.seed, "")
643643
file.write(processed.infotext(p, 0))
644644

645-
uc = get_conds_with_caching(prompt_parser.get_learned_conditioning, negative_prompts, p.steps, cached_uc)
646-
c = get_conds_with_caching(prompt_parser.get_multicond_learned_conditioning, prompts, p.steps, cached_c)
645+
step_multiplier = 1
646+
if not shared.opts.dont_fix_second_order_samplers_schedule:
647+
try:
648+
step_multiplier = 2 if sd_samplers.all_samplers_map.get(p.sampler_name).aliases[0] in ['k_dpmpp_2s_a', 'k_dpmpp_2s_a_ka', 'k_dpmpp_sde', 'k_dpmpp_sde_ka', 'k_dpm_2', 'k_dpm_2_a', 'k_heun'] else 1
649+
except:
650+
pass
651+
uc = get_conds_with_caching(prompt_parser.get_learned_conditioning, negative_prompts, p.steps * step_multiplier, cached_uc)
652+
c = get_conds_with_caching(prompt_parser.get_multicond_learned_conditioning, prompts, p.steps * step_multiplier, cached_c)
647653

648654
if len(model_hijack.comments) > 0:
649655
for comment in model_hijack.comments:

modules/shared.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ def list_samplers():
360360
"use_old_karras_scheduler_sigmas": OptionInfo(False, "Use old karras scheduler sigmas (0.1 to 10)."),
361361
"no_dpmpp_sde_batch_determinism": OptionInfo(False, "Do not make DPM++ SDE deterministic across different batch sizes."),
362362
"use_old_hires_fix_width_height": OptionInfo(False, "For hires fix, use width/height sliders to set final resolution rather than first pass (disables Upscale by, Resize width/height to)."),
363+
"dont_fix_second_order_samplers_schedule": OptionInfo(False, "Do not fix prompt schedule for second order samplers."),
363364
}))
364365

365366
options_templates.update(options_section(('interrogate', "Interrogate Options"), {

0 commit comments

Comments
 (0)