The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Don't crash when using flux kv cache with split batches. (#14422)
comfyanonymous10d466b0e3a8
diff --git a/comfy_extras/nodes_flux.py b/comfy_extras/nodes_flux.pyindex afc663b22..ef1757ae5 100644--- a/comfy_extras/nodes_flux.py+++ b/comfy_extras/nodes_flux.py@@ -245,6 +245,11 @@ class KV_Attn_Input:cache_key = "{}_{}".format(extra_options["block_type"], extra_options["block_index"])if cache_key in self.cache:kk, vv = self.cache[cache_key]++ # Fix batch size changing.+ kk = comfy.utils.repeat_to_batch_size(kk, k.shape[0])+ vv = comfy.utils.repeat_to_batch_size(vv, v.shape[0])+self.set_cache = Falsereturn {"q": q, "k": torch.cat((k, kk), dim=2), "v": torch.cat((v, vv), dim=2)}