Round image sizes to a multiple of 8

This commit is contained in:
cmdr2 2023-08-03 10:22:24 +05:30
parent 83c93eb9ef
commit f0f6578b9c
2 changed files with 10 additions and 2 deletions

View File

@ -223,6 +223,8 @@ def generate_images_internal(
if req.init_image is not None and not context.test_diffusers: if req.init_image is not None and not context.test_diffusers:
req.sampler_name = "ddim" req.sampler_name = "ddim"
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: if req.control_image and task_data.control_filter_to_apply:
req.control_image = filter_images(context, req.control_image, task_data.control_filter_to_apply)[0] req.control_image = filter_images(context, req.control_image, task_data.control_filter_to_apply)[0]

View File

@ -1365,6 +1365,12 @@ function getCurrentUserRequest() {
// numOutputsParallel = 1 // force 1 parallel // numOutputsParallel = 1 // force 1 parallel
// } // }
// clamp to multiple of 8
let width = parseInt(widthField.value)
let height = parseInt(heightField.value)
width = width - (width % 8)
height = height - (height % 8)
const newTask = { const newTask = {
batchesDone: 0, batchesDone: 0,
numOutputsTotal: numOutputsTotal, numOutputsTotal: numOutputsTotal,
@ -1377,8 +1383,8 @@ function getCurrentUserRequest() {
num_outputs: numOutputsParallel, num_outputs: numOutputsParallel,
num_inference_steps: parseInt(numInferenceStepsField.value), num_inference_steps: parseInt(numInferenceStepsField.value),
guidance_scale: parseFloat(guidanceScaleField.value), guidance_scale: parseFloat(guidanceScaleField.value),
width: parseInt(widthField.value), width: width,
height: parseInt(heightField.value), height: height,
// allow_nsfw: allowNSFWField.checked, // allow_nsfw: allowNSFWField.checked,
vram_usage_level: vramUsageLevelField.value, vram_usage_level: vramUsageLevelField.value,
sampler_name: samplerField.value, sampler_name: samplerField.value,