mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
force align width/height to vae scale factor
Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
@@ -49,12 +49,13 @@ def task_specific_kwargs(p, model):
|
||||
p.init_images = [helpers.decode_base64_to_image(i, quiet=True) for i in p.init_images]
|
||||
if isinstance(p.init_images[0], Image.Image):
|
||||
p.init_images = [i.convert('RGB') if i.mode != 'RGB' else i for i in p.init_images if i is not None]
|
||||
p.width, p.height = processing_helpers.resize_init_images(p)
|
||||
if (task_type == sd_models.DiffusersTaskType.TEXT_2_IMAGE or len(getattr(p, 'init_images', [])) == 0) and not is_img2img_model and 'video' not in p.ops:
|
||||
p.ops.append('txt2img')
|
||||
if hasattr(p, 'width') and hasattr(p, 'height'):
|
||||
task_args = {
|
||||
'width': vae_scale_factor * math.ceil(p.width / vae_scale_factor),
|
||||
'height': vae_scale_factor * math.ceil(p.height / vae_scale_factor),
|
||||
'width': p.width,
|
||||
'height': p.height,
|
||||
}
|
||||
elif (task_type == sd_models.DiffusersTaskType.IMAGE_2_IMAGE or is_img2img_model) and len(getattr(p, 'init_images', [])) > 0:
|
||||
if shared.sd_model_type == 'sdxl' and hasattr(model, 'register_to_config'):
|
||||
@@ -93,8 +94,8 @@ def task_specific_kwargs(p, model):
|
||||
elif task_type == sd_models.DiffusersTaskType.INSTRUCT and len(getattr(p, 'init_images', [])) > 0:
|
||||
p.ops.append('instruct')
|
||||
task_args = {
|
||||
'width': vae_scale_factor * math.ceil(p.width / vae_scale_factor) if hasattr(p, 'width') else None,
|
||||
'height': vae_scale_factor * math.ceil(p.height / vae_scale_factor) if hasattr(p, 'height') else None,
|
||||
'width': p.width,
|
||||
'height': p.height,
|
||||
'image': p.init_images,
|
||||
'strength': p.denoising_strength,
|
||||
}
|
||||
@@ -108,7 +109,6 @@ def task_specific_kwargs(p, model):
|
||||
p.ops.append('detailer')
|
||||
else:
|
||||
p.ops.append('inpaint')
|
||||
width, height = processing_helpers.resize_init_images(p)
|
||||
mask_image = p.task_args.get('image_mask', None) or getattr(p, 'image_mask', None) or getattr(p, 'mask', None)
|
||||
if p.vae_type == 'Remote':
|
||||
from modules.sd_vae_remote import remote_encode
|
||||
@@ -118,8 +118,8 @@ def task_specific_kwargs(p, model):
|
||||
'image': p.init_images,
|
||||
'mask_image': mask_image,
|
||||
'strength': p.denoising_strength,
|
||||
'height': height,
|
||||
'width': width,
|
||||
'height': p.height,
|
||||
'width': p.width,
|
||||
}
|
||||
|
||||
# model specific args
|
||||
|
||||
Reference in New Issue
Block a user