MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / forward

Method forward

diffsynth/models/sdxl_text_encoder.py:72–82  ·  view source on GitHub ↗
(self, input_ids, clip_skip=2)

Source from the content-addressed store, hash-verified

70 return mask
71
72 def forward(self, input_ids, clip_skip=2):
73 embeds = self.token_embedding(input_ids) + self.position_embeds
74 attn_mask = self.attn_mask.to(device=embeds.device, dtype=embeds.dtype)
75 for encoder_id, encoder in enumerate(self.encoders):
76 embeds = encoder(embeds, attn_mask=attn_mask)
77 if encoder_id + clip_skip == len(self.encoders):
78 hidden_states = embeds
79 embeds = self.final_layer_norm(embeds)
80 pooled_embeds = embeds[torch.arange(embeds.shape[0]), input_ids.to(dtype=torch.int).argmax(dim=-1)]
81 pooled_embeds = self.text_projection(pooled_embeds)
82 return pooled_embeds, hidden_states
83
84 @staticmethod
85 def state_dict_converter():

Callers

nothing calls this directly

Calls 1

toMethod · 0.45

Tested by

no test coverage detected