(self, input_ids, attention_mask, text_encoder_use_attention_mask=False)
| 346 | return text_inputs |
| 347 | |
| 348 | def _encode_prompt(self, input_ids, attention_mask, text_encoder_use_attention_mask=False): |
| 349 | text_input_ids = input_ids.to(self.device) |
| 350 | |
| 351 | if text_encoder_use_attention_mask: |
| 352 | attention_mask = attention_mask.to(self.device) |
| 353 | else: |
| 354 | attention_mask = None |
| 355 | |
| 356 | prompt_embeds = self.text_encoder( |
| 357 | text_input_ids, |
| 358 | attention_mask=attention_mask, |
| 359 | ) |
| 360 | prompt_embeds = prompt_embeds[0] |
| 361 | |
| 362 | return prompt_embeds |
| 363 | |
| 364 | @torch.no_grad() |
| 365 | def _get_text_embed(self, prompt): |
no test coverage detected