MCPcopy Create free account
hub / github.com/Francis-Rings/StableAnimator / __init__

Method __init__

animation/modules/id_encoder.py:70–98  ·  view source on GitHub ↗
(
        self,
        dim=768,
        depth=4,
        dim_head=64,
        heads=16,
        embedding_dim=1280,
        output_dim=768,
        ff_mult=4,
    )

Source from the content-addressed store, hash-verified

68
69class FacePerceiver(torch.nn.Module):
70 def __init__(
71 self,
72 dim=768,
73 depth=4,
74 dim_head=64,
75 heads=16,
76 embedding_dim=1280,
77 output_dim=768,
78 ff_mult=4,
79 ):
80 super().__init__()
81
82 self.proj_in = torch.nn.Linear(embedding_dim, dim)
83 self.proj_out = torch.nn.Linear(dim, output_dim)
84 self.norm_out = torch.nn.LayerNorm(output_dim)
85 self.layers = torch.nn.ModuleList([])
86 for _ in range(depth):
87 self.layers.append(
88 torch.nn.ModuleList(
89 [
90 PerceiverAttention(dim=dim, dim_head=dim_head, heads=heads),
91 FeedForward(dim=dim, mult=ff_mult),
92 ]
93 )
94 )
95
96 nn.init.constant_(self.proj_out.weight, 0)
97 if self.proj_out.bias is not None:
98 nn.init.constant_(self.proj_out.bias, 0)
99
100 def forward(self, latents, x):
101 x = self.proj_in(x)

Callers

nothing calls this directly

Calls 3

PerceiverAttentionClass · 0.85
FeedForwardFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected