From 615cfd3217e7f8e6b2ca9f46606d4e95d2746293 Mon Sep 17 00:00:00 2001 From: kinfolk0117 Date: Sun, 27 Oct 2024 10:02:54 +0100 Subject: [PATCH] Better error message if latents % cells != 0 --- nodes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nodes.py b/nodes.py index 9e0a54d..44742c8 100644 --- a/nodes.py +++ b/nodes.py @@ -281,6 +281,11 @@ class GridSwapper: latent_image = latent_image.clone() no_latents = latent_image.shape[0] + + if no_latents % cells != 0: + raise ValueError(f"Number of latents ({no_latents}) is not a multiple of cells ({cells}), latents need to be divisible by cells. With {rows} rows x {cols} cols = {cells} cells, this means for example {1*cells}, {2*cells}, {3*cells}, ... latents are supported.") + + perms = self.get_diverse_permutations_fast(no_latents, steps) no_combined = latent_image.shape[0] // cells