MCPcopy Create free account
hub / github.com/UVA-Computer-Vision-Lab/FrameINO / encode_prompt

Function encode_prompt

train_code/train_wan_motion.py:322–345  ·  view source on GitHub ↗
(
    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,
)

Source from the content-addressed store, hash-verified

320
321
322def 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

Callers 1

Calls 1

_get_t5_prompt_embedsFunction · 0.70

Tested by

no test coverage detected