MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / encode_prompt

Method encode_prompt

diffsynth/prompters/flux_prompter.py:56–74  ·  view source on GitHub ↗
(
        self,
        prompt,
        positive=True,
        device="cuda",
        t5_sequence_length=512,
    )

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

process_promptMethod · 0.80
toMethod · 0.45

Tested by

no test coverage detected