From a1e7cceb7d0413d3acf4cda80f5430759d48f35d Mon Sep 17 00:00:00 2001 From: Erich Schubert Date: Mon, 3 Jun 2024 16:13:02 +0200 Subject: [PATCH] Fix and() for SDXL #78 Closes #78 --- src/compel/compel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compel/compel.py b/src/compel/compel.py index 3c34dfc..7e78f8d 100644 --- a/src/compel/compel.py +++ b/src/compel/compel.py @@ -188,7 +188,9 @@ def build_conditioning_tensor_for_conjunction(self, conjunction: Conjunction) -> weight = conjunction.weights[i] if weight != 1: # apply weight if we need to - empty_conditioning = self.build_conditioning_tensor('') if empty_conditioning is None else empty_conditioning + if empty_conditioning is None: + empty_conditioning = self.build_conditioning_tensor('') + if isinstance(empty_conditioning, tuple): empty_conditioning = empty_conditioning[0] # discard pooled [padded_empty_conditioning, _] = self.pad_conditioning_tensors_to_same_length([empty_conditioning, this_conditioning]) this_conditioning = padded_empty_conditioning + (this_conditioning - padded_empty_conditioning) * weight to_concat.append(this_conditioning)