improve infotext param parsing

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-07-06 17:31:21 -04:00
parent 4dc56c6813
commit a12f8cbc8d
4 changed files with 11 additions and 7 deletions
+3 -3
View File
@@ -34,9 +34,9 @@ def parse(infotext):
debug(f'Raw: {infotext}')
remaining = infotext.replace('\nSteps:', ' Steps:')
params = [' steps:', ' seed:', ' width:', ' height:', ' sampler:', ' size:', ' cfg scale:'] # first param is one of those
params += ['\nsteps:', '\nseed:', '\nwidth:', '\nheight:', '\nsampler:', '\nsize:', '\ncfg scale:']
params += ['.steps:', '.seed:', '.width:', '.height:', '.sampler:', '.size:', '.cfg scale:']
params = [' steps:', ' seed:', ' width:', ' height:', ' sampler:', ' size:', ' cfg scale:', ' pipeline:'] # first param is one of those
params += ['\nsteps:', '\nseed:', '\nwidth:', '\nheight:', '\nsampler:', '\nsize:', '\ncfg scale:', '\npipeline:']
params += ['.steps:', '.seed:', '.width:', '.height:', '.sampler:', '.size:', '.cfg scale:', '.pipeline:']
prompt_end = [remaining.lower().find(p) for p in params if p in remaining.lower()]
prompt_end += [remaining.lower().find('negative prompt:')]
+5 -2
View File
@@ -1,5 +1,6 @@
from PIL import Image
from modules.upscaler import Upscaler, UpscalerData
from modules.shared import log
class UpscalerNone(Upscaler):
@@ -71,7 +72,8 @@ class UpscalerLatent(Upscaler):
if isinstance(img, torch.Tensor) and (len(img.shape) == 4):
_batch, _channel, h, w = img.shape
else:
raise ValueError(f"Latent upscale: image={img.shape if isinstance(img, torch.Tensor) else img} type={type(img)} if not supported")
log.error(f"Upscale: type=latent image={img.shape if isinstance(img, torch.Tensor) else img} type={type(img)} if not supported")
return img
h, w = int((8 * h * self.scale) // 8), int((8 * w * self.scale) // 8)
mode, antialias = '', ''
if selected_model == "Latent Nearest":
@@ -89,7 +91,8 @@ class UpscalerLatent(Upscaler):
elif selected_model == "Latent Bicubic antialias":
mode, antialias = 'bicubic', True
else:
raise ValueError(f"Latent upscale: model={selected_model} unknown")
raise log.error(f"Upscale: type=latent model={selected_model} unknown")
return img
return F.interpolate(img, size=(h, w), mode=mode, antialias=antialias)