(
tokenizer: AutoTokenizer,
text_encoder: UMT5EncoderModel,
prompt: Union[str, List[str]],
num_videos_per_prompt: int = 1,
max_sequence_length: int = 226,
device: Optional[torch.device] = None,
dtype: Optional[torch.dtype] = None,
text_input_ids=None,
)
| 320 | |
| 321 | |
| 322 | def encode_prompt( |
| 323 | tokenizer: AutoTokenizer, |
| 324 | text_encoder: UMT5EncoderModel, |
| 325 | prompt: Union[str, List[str]], |
| 326 | num_videos_per_prompt: int = 1, |
| 327 | max_sequence_length: int = 226, |
| 328 | device: Optional[torch.device] = None, |
| 329 | dtype: Optional[torch.dtype] = None, |
| 330 | text_input_ids=None, |
| 331 | ): |
| 332 | |
| 333 | # prompt = [prompt] if isinstance(prompt, str) else prompt |
| 334 | prompt_embeds = _get_t5_prompt_embeds( |
| 335 | tokenizer, |
| 336 | text_encoder, |
| 337 | prompt = prompt, |
| 338 | num_videos_per_prompt = num_videos_per_prompt, |
| 339 | max_sequence_length = max_sequence_length, |
| 340 | device = device, |
| 341 | dtype = dtype, |
| 342 | text_input_ids = text_input_ids, |
| 343 | ) |
| 344 | |
| 345 | return prompt_embeds |
| 346 | |
| 347 | |
| 348 |
no test coverage detected