sdkit 1.0.176 - resize control images to the task dimensions, to avoid memory errors with high-res control images

This commit is contained in:
cmdr2 2023-08-18 18:43:23 +05:30
parent 7f878f365b
commit ab4d34e509
2 changed files with 5 additions and 1 deletions

View File

@ -18,7 +18,7 @@ os_name = platform.system()
modules_to_check = {
"torch": ("1.11.0", "1.13.1", "2.0.0"),
"torchvision": ("0.12.0", "0.14.1", "0.15.1"),
"sdkit": "1.0.175",
"sdkit": "1.0.176",
"stable-diffusion-sdkit": "2.1.4",
"rich": "12.6.0",
"uvicorn": "0.19.0",

View File

@ -15,6 +15,8 @@ from sdkit.utils import (
img_to_base64_str,
img_to_buffer,
latent_samples_to_images,
resize_img,
get_image,
log,
)
@ -226,6 +228,8 @@ def generate_images_internal(
req.width, req.height = map(lambda x: x - x % 8, (req.width, req.height)) # clamp to 8
if req.control_image and task_data.control_filter_to_apply:
req.control_image = get_image(req.control_image)
req.control_image = resize_img(req.control_image.convert("RGB"), req.width, req.height, clamp_to_8=True)
req.control_image = filter_images(context, req.control_image, task_data.control_filter_to_apply)[0]
if context.test_diffusers: