MCPcopy Create free account
hub / github.com/tdrussell/diffusion-pipe / get_text_embeddings

Function get_text_embeddings

tools/test_ideogram4.py:38–44  ·  view source on GitHub ↗
(prompt)

Source from the content-addressed store, hash-verified

36clip = comfy.sd.load_clip(ckpt_paths=[TEXT_ENCODER_PATH], clip_type=comfy.sd.CLIPType.IDEOGRAM4, disable_dynamic=True)
37
38def 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
47conds = get_text_embeddings(prompt)

Callers 1

test_ideogram4.pyFile · 0.85

Calls 1

toMethod · 0.45

Tested by

no test coverage detected