From e2fafe0686a5bda8158b8e823a8d351e3f0ded7e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 9 Dec 2024 03:57:14 -0500 Subject: [PATCH] Make CLIP set last layer node work with t5 models. --- comfy/text_encoders/t5.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy/text_encoders/t5.py b/comfy/text_encoders/t5.py index a1420c6c..f88ed9cf 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: