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

Function encode_prompt

train_code/train_cogvideox_motion.py:262–285  ·  view source on GitHub ↗
(
    tokenizer: T5Tokenizer,
    text_encoder: T5EncoderModel,
    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

260
261
262def encode_prompt(
263 tokenizer: T5Tokenizer,
264 text_encoder: T5EncoderModel,
265 prompt: Union[str, List[str]],
266 num_videos_per_prompt: int = 1,
267 max_sequence_length: int = 226,
268 device: Optional[torch.device] = None,
269 dtype: Optional[torch.dtype] = None,
270 text_input_ids=None,
271):
272
273 # prompt = [prompt] if isinstance(prompt, str) else prompt
274 prompt_embeds = _get_t5_prompt_embeds(
275 tokenizer,
276 text_encoder,
277 prompt = prompt,
278 num_videos_per_prompt = num_videos_per_prompt,
279 max_sequence_length = max_sequence_length,
280 device = device,
281 dtype = dtype,
282 text_input_ids = text_input_ids,
283 )
284
285 return prompt_embeds
286
287
288

Callers 1

Calls 1

_get_t5_prompt_embedsFunction · 0.70

Tested by

no test coverage detected