fix img2img sampler selection

This commit is contained in:
Vladimir Mandic
2024-01-02 10:30:38 -05:00
parent d1ea22b7ea
commit 3881f51fde
4 changed files with 10 additions and 6 deletions
+6 -4
View File
@@ -121,12 +121,14 @@ def txt2img_image_conditioning(sd_model, x, width, height):
def get_sampler_name(sampler_index: int, img: bool = False) -> str:
samplers = modules.sd_samplers.samplers if not img else modules.sd_samplers.samplers_for_img2img
if len(samplers) > sampler_index:
sampler_name = samplers[sampler_index].name
if len(modules.sd_samplers.samplers) > sampler_index:
sampler_name = modules.sd_samplers.samplers[sampler_index].name
else:
sampler_name = "UniPC"
shared.log.warning(f'Sampler not found: index={sampler_index} available={[s.name for s in samplers]} fallback={sampler_name}')
shared.log.warning(f'Sampler not found: index={sampler_index} available={[s.name for s in modules.sd_samplers.samplers]} fallback={sampler_name}')
if img and sampler_name == "PLMS":
sampler_name = "UniPC"
shared.log.warning(f'Sampler not compatible: name=PLMS fallback={sampler_name}')
return sampler_name