Skip to content

Commit 8d2b4e2

Browse files
feat(nodes): support FLUX, SD3 in ideal_size
1 parent aba70ea commit 8d2b4e2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

invokeai/app/invocations/ideal_size.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class IdealSizeOutput(BaseInvocationOutput):
2121
"ideal_size",
2222
title="Ideal Size",
2323
tags=["latents", "math", "ideal_size"],
24-
version="1.0.3",
24+
version="1.0.4",
2525
)
2626
class IdealSizeInvocation(BaseInvocation):
2727
"""Calculates the ideal size for generation to avoid duplication"""
@@ -41,11 +41,16 @@ def trim_to_multiple_of(self, *args: int, multiple_of: int = LATENT_SCALE_FACTOR
4141
def invoke(self, context: InvocationContext) -> IdealSizeOutput:
4242
unet_config = context.models.get_config(self.unet.unet.key)
4343
aspect = self.width / self.height
44-
dimension: float = 512
45-
if unet_config.base == BaseModelType.StableDiffusion2:
44+
45+
if unet_config.base == BaseModelType.StableDiffusion1:
46+
dimension = 512
47+
elif unet_config.base == BaseModelType.StableDiffusion2:
4648
dimension = 768
47-
elif unet_config.base == BaseModelType.StableDiffusionXL:
49+
elif unet_config.base in (BaseModelType.StableDiffusionXL, BaseModelType.Flux, BaseModelType.StableDiffusion3):
4850
dimension = 1024
51+
else:
52+
raise ValueError(f"Unsupported model type: {unet_config.base}")
53+
4954
dimension = dimension * self.multiplier
5055
min_dimension = math.floor(dimension * 0.5)
5156
model_area = dimension * dimension # hardcoded for now since all models are trained on square images

0 commit comments

Comments
 (0)