This commit is contained in:
Haoming 2026-05-07 11:44:24 +08:00
parent 28e39472a1
commit cd2490a8d2

View File

@ -1,3 +1,4 @@
import math
from typing import TYPE_CHECKING
if TYPE_CHECKING:
@ -114,8 +115,8 @@ class AnimaTextProcessingEngine:
if t5xxl_weights is not None:
cross_attn *= t5xxl_weights.unsqueeze(0).unsqueeze(-1).to(cross_attn)
if cross_attn.shape[1] < 512:
cross_attn = torch.nn.functional.pad(cross_attn, (0, 0, 0, 512 - cross_attn.shape[1]))
dim = math.ceil(cross_attn.shape[1] / 512) * 512
cross_attn = torch.nn.functional.pad(cross_attn, (0, 0, 0, dim - cross_attn.shape[1]))
return cross_attn