allow generation to be started with any dimensions specified

This commit is contained in:
AUTOMATIC1111 2024-06-28 18:06:49 +03:00
parent 179ae47d64
commit d67348a0a5
2 changed files with 6 additions and 0 deletions

View File

@ -75,3 +75,6 @@ class SD3Inferencer(torch.nn.Module):
def add_noise_to_latent(self, x, noise, amount):
return x * (1 - amount) + noise * amount
def fix_dimensions(self, width, height):
return width // 16 * 16, height // 16 * 16

View File

@ -884,6 +884,9 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
if p.refiner_checkpoint_info is None:
raise Exception(f'Could not find checkpoint with name {p.refiner_checkpoint}')
if hasattr(shared.sd_model, 'fix_dimensions'):
p.width, p.height = shared.sd_model.fix_dimensions(p.width, p.height)
p.sd_model_name = shared.sd_model.sd_checkpoint_info.name_for_extra
p.sd_model_hash = shared.sd_model.sd_model_hash
p.sd_vae_name = sd_vae.get_loaded_vae_name()