MCPcopy Create free account
hub / github.com/devinxzhang/MFuser / forward

Method forward

models/backbones/clip/models.py:424–433  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

422 return mask
423
424 def forward(self, text):
425 x = self.token_embedding(text) # [batch_size, n_ctx, d_model]
426 x = x + self.positional_embedding
427 x = x.permute(1, 0, 2) # NLD -> LND
428 x = self.transformer(x)
429 x = x.permute(1, 0, 2) # LND -> NLD
430 x = self.ln_final(x)
431 x = x[torch.arange(x.shape[0]), text.argmax(dim=-1)] @ self.text_projection
432 # x = self.out_proj(x)
433 return x
434
435@BACKBONES.register_module()
436class CLIPTextContextEncoder(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected