Merge pull request #4913 from QualiaRain/fix/freescale-fixes

Fix FreeScale early-return state corruption and stage resolution rounding
This commit is contained in:
Vladimir Mandic
2026-06-12 10:41:18 +02:00
committed by GitHub
+5 -5
View File
@@ -67,7 +67,7 @@ class FreeScaleScript(scripts_manager.Script):
def scale(x):
if (p.width == 0 or p.height == 0) and p.init_images is not None:
p.width, p.height = p.init_images[0].width, p.init_images[0].height
resolution = [int(8 * p.width * x // 8), int(8 * p.height * x // 8)]
resolution = [8 * int(p.width * x // 8), 8 * int(p.height * x // 8)]
return resolution
scales = []
@@ -90,6 +90,10 @@ class FreeScaleScript(scripts_manager.Script):
resolutions_list.append(scale(s4_scale))
restart_steps.append(int(p.steps * s4_restart))
if p.width < 1024 or p.height < 1024:
log.error(f'FreeScale: width={p.width} height={p.height} minimum=1024')
return None
p.task_args['resolutions_list'] = resolutions_list
p.task_args['cosine_scale'] = cosine_scale
p.task_args['restart_steps'] = [min(max(1, step), p.steps-1) for step in restart_steps]
@@ -101,10 +105,6 @@ class FreeScaleScript(scripts_manager.Script):
if override_sampler:
p.sampler_name = 'Euler a'
if p.width < 1024 or p.height < 1024:
log.error(f'FreeScale: width={p.width} height={p.height} minimum=1024')
return None
if not self.is_img2img:
shared.sd_model = sd_models.switch_pipe(StableDiffusionXLFreeScale, shared.sd_model)
else: