(prompt)
| 36 | clip = comfy.sd.load_clip(ckpt_paths=[TEXT_ENCODER_PATH], clip_type=comfy.sd.CLIPType.IDEOGRAM4, disable_dynamic=True) |
| 37 | |
| 38 | def get_text_embeddings(prompt): |
| 39 | tokens = clip.tokenize(prompt) |
| 40 | o = clip.encode_from_tokens_scheduled(tokens) |
| 41 | text_embeds = o[0][0] |
| 42 | extra = o[0][1] |
| 43 | attention_mask = extra['attention_mask'] |
| 44 | return text_embeds.to('cuda'), attention_mask.to('cuda') |
| 45 | |
| 46 | # compute conds |
| 47 | conds = get_text_embeddings(prompt) |