MCPcopy Index your code
hub / github.com/huggingface/diffusers / text_encoder

Function text_encoder

scripts/convert_kakao_brain_unclip_to_diffusers.py:919–939  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

917
918
919def text_encoder():
920 print("loading CLIP text encoder")
921
922 clip_name = "openai/clip-vit-large-patch14"
923
924 # sets pad_value to 0
925 pad_token = "!"
926
927 tokenizer_model = CLIPTokenizer.from_pretrained(clip_name, pad_token=pad_token, device_map="auto")
928
929 assert tokenizer_model.convert_tokens_to_ids(pad_token) == 0
930
931 text_encoder_model = CLIPTextModelWithProjection.from_pretrained(
932 clip_name,
933 # `CLIPTextModel` does not support device_map="auto"
934 # device_map="auto"
935 )
936
937 print("done loading CLIP text encoder")
938
939 return text_encoder_model, tokenizer_model
940
941
942def prior(*, args, checkpoint_map_location):

Callers 15

encode_promptMethod · 0.85
encode_promptMethod · 0.85
encode_promptMethod · 0.85
encode_promptMethod · 0.85
encode_promptMethod · 0.85
encode_promptMethod · 0.85
encode_promptMethod · 0.85
encode_promptMethod · 0.85

Calls 1

from_pretrainedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…