MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / forward

Method forward

wan/models/portrait_encoder.py:134–147  ·  view source on GitHub ↗
(self, adapter_embeds)

Source from the content-addressed store, hash-verified

132 self.norm = torch.nn.LayerNorm(cross_attention_dim)
133
134 def forward(self, adapter_embeds):
135 B, num_frames, C = adapter_embeds.shape
136 embeds = adapter_embeds
137 split_sizes = [6, 6, 30, 512]
138 headpose, eye, emo, mouth = torch.split(embeds, split_sizes, dim=-1)
139 headpose = self.norm(self.headpose_proj(headpose))
140 eye = self.norm(self.eye_proj(eye))
141 emo = self.norm(self.emo_proj(emo))
142 mouth = self.norm(self.mouth_proj(mouth))
143
144 all_features = torch.stack([headpose, eye, emo, mouth], dim=2)
145 result_final = all_features.view(B, num_frames * 4, self.cross_attention_dim)
146
147 return result_final
148
149
150class PortraitEncoder(ModelMixin, ConfigMixin, FromOriginalModelMixin):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected