(self, text)
| 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() |
| 436 | class CLIPTextContextEncoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected