(self, clip_model)
| 42 | |
| 43 | class TextEncoder(nn.Module): |
| 44 | def __init__(self, clip_model): |
| 45 | super().__init__() |
| 46 | self.transformer = clip_model.transformer |
| 47 | self.positional_embedding = clip_model.positional_embedding |
| 48 | self.ln_final = clip_model.ln_final |
| 49 | self.text_projection = clip_model.text_projection |
| 50 | self.dtype = clip_model.dtype |
| 51 | |
| 52 | def forward(self, prompts, tokenized_prompts, compound_prompts_deeper_text): |
| 53 | x = prompts + self.positional_embedding.type(self.dtype) |