diff --git a/comfy/ldm/hydit/poolers.py b/comfy/ldm/hydit/poolers.py index c8b1030b8..bcc8ef573 100644 --- a/comfy/ldm/hydit/poolers.py +++ b/comfy/ldm/hydit/poolers.py @@ -7,7 +7,7 @@ import torch.nn.functional as F class AttentionPool(nn.Module): def __init__(self, spacial_dim: int, embed_dim: int, num_heads: int, output_dim: int = None, dtype=None, device=None, operations=None): super().__init__() - self.positional_embedding = nn.Parameter(torch.randn(spacial_dim + 1, embed_dim) / embed_dim ** 0.5) + self.positional_embedding = nn.Parameter(torch.empty(spacial_dim + 1, embed_dim, dtype=dtype, device=device)) self.k_proj = operations.Linear(embed_dim, embed_dim, dtype=dtype, device=device) self.q_proj = operations.Linear(embed_dim, embed_dim, dtype=dtype, device=device) self.v_proj = operations.Linear(embed_dim, embed_dim, dtype=dtype, device=device)