mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
improve infotext param parsing
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+3
-3
@@ -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:')]
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user