(
self,
prompt,
positive=True,
device="cuda",
t5_sequence_length=512,
)
| 54 | |
| 55 | |
| 56 | def encode_prompt( |
| 57 | self, |
| 58 | prompt, |
| 59 | positive=True, |
| 60 | device="cuda", |
| 61 | t5_sequence_length=512, |
| 62 | ): |
| 63 | prompt = self.process_prompt(prompt, positive=positive) |
| 64 | |
| 65 | # CLIP |
| 66 | pooled_prompt_emb = self.encode_prompt_using_clip(prompt, self.text_encoder_1, self.tokenizer_1, 77, device) |
| 67 | |
| 68 | # T5 |
| 69 | prompt_emb = self.encode_prompt_using_t5(prompt, self.text_encoder_2, self.tokenizer_2, t5_sequence_length, device) |
| 70 | |
| 71 | # text_ids |
| 72 | text_ids = torch.zeros(prompt_emb.shape[0], prompt_emb.shape[1], 3).to(device=device, dtype=prompt_emb.dtype) |
| 73 | |
| 74 | return prompt_emb, pooled_prompt_emb, text_ids |
nothing calls this directly
no test coverage detected