Views
No views yet
models/clip/export.py), with one change: text
inputs are padded to the full 77-token context (padding="max_length") so free-text
queries work, instead of the recipe's 7-token example trace.ImageTextEncoder:1let encoder = try await ImageTextEncoder() // downloads this repo
2let imageVec = try await encoder.encode(image: cgImage)
3let textVec = try await encoder.encode(text: "red bike at the beach")
4let score = ImageTextEncoder.cosineSimilarity(imageVec, textVec)model/
├── clip-vit-base-patch32_float16_static.aimodel
└── tokenizer.json| name | shape | dtype | |
|---|---|---|---|
| input | pixel_values | [1, 3, 224, 224] | fp16 |
| input | input_ids | [3, 77] | int32 |
| input | attention_mask | [3, 77] | int32 |
| output | image_embeds | [1, 512] | fp16, L2-normalized |
| output | text_embeds | [3, 512] | fp16, L2-normalized |
| output | logits_per_image / logits_per_text | [1, 3] / [3, 1] | fp16 |
ImageTextEncoder).