From d9f0fcdb0cdfd8f6fd0ec2ee14ea332bb87fd504 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 11 Feb 2025 17:17:03 -0500 Subject: [PATCH] Cleanup. --- comfy/clip_model.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/comfy/clip_model.py b/comfy/clip_model.py index 0163c6fe7d5..cf5b58b62a3 100644 --- a/comfy/clip_model.py +++ b/comfy/clip_model.py @@ -104,10 +104,7 @@ def forward(self, input_tokens, attention_mask=None, intermediate_output=None, f mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) mask = mask.masked_fill(mask.to(torch.bool), -torch.finfo(x.dtype).max) - if comfy.model_management.is_directml_enabled(): - causal_mask = torch.full((x.shape[1], x.shape[1]), -torch.finfo(x.dtype).max, dtype=x.dtype, device=x.device).triu_(1) - else: - causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(float("-inf")).triu_(1) + causal_mask = torch.full((x.shape[1], x.shape[1]), -torch.finfo(x.dtype).max, dtype=x.dtype, device=x.device).triu_(1) if mask is not None: mask += causal_mask