Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Make CLIP set last layer node work with t5 models.

comfyanonymouse2fafe0686a5
diff --git a/comfy/text_encoders/t5.py b/comfy/text_encoders/t5.py
index a1420c6cd..f88ed9cf8 100644
--- a/comfy/text_encoders/t5.py
+++ b/comfy/text_encoders/t5.py
@@ -209,6 +209,11 @@ class T5Stack(torch.nn.Module):
intermediate = None
optimized_attention = optimized_attention_for_device(x.device, mask=attention_mask is not None, small_input=True)
past_bias = None
+
+ if intermediate_output is not None:
+ if intermediate_output < 0:
+ intermediate_output = len(self.block) + intermediate_output
+
for i, l in enumerate(self.block):
x, past_bias = l(x, mask, past_bias, optimized_attention)
if i == intermediate_output: