update casual mask calculation

This commit is contained in:
Chowdhury, Hisham 2025-02-11 11:41:17 -08:00
parent 7b82959572
commit f594ea41f5

View File

@ -105,7 +105,7 @@ class CLIPTextModel_(torch.nn.Module):
mask = mask.masked_fill(mask.to(torch.bool), -torch.finfo(x.dtype).max)
if comfy.model_management.is_directml_enabled():
causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).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)
else:
causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(float("-inf")).triu_(1)