mlboydaisuke commited on
Commit
5ea2781
·
verified ·
1 Parent(s): 5ba27a1

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model/clip-vit-base-patch32_float16_static.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - coreai
5
+ - clip
6
+ - apple-silicon
7
+ - on-device
8
+ ---
9
+
10
+ # CLIP ViT-B/32 — Core AI export (official recipe)
11
+
12
+ fp16 static export of [openai/clip-vit-base-patch32](https://huggingface.co/openai/clip-vit-base-patch32)
13
+ via apple/coreai-models' official recipe (`models/clip/export.py`), with one change: text
14
+ inputs are padded to the full 77-token context (`padding="max_length"`) so free-text
15
+ queries work, instead of the recipe's 7-token example trace.
16
+
17
+ Runs out of the box with [CoreAIKit](https://github.com/john-rocky/coreai-kit)'s
18
+ `ImageTextEncoder`:
19
+
20
+ ```swift
21
+ let encoder = try await ImageTextEncoder() // downloads this repo
22
+ let imageVec = try await encoder.encode(image: cgImage)
23
+ let textVec = try await encoder.encode(text: "red bike at the beach")
24
+ let score = ImageTextEncoder.cosineSimilarity(imageVec, textVec)
25
+ ```
26
+
27
+ ## Bundle layout
28
+
29
+ ```
30
+ model/
31
+ ├── clip-vit-base-patch32_float16_static.aimodel
32
+ └── tokenizer.json
33
+ ```
34
+
35
+ ## Graph contract
36
+
37
+ | | name | shape | dtype |
38
+ |---|---|---|---|
39
+ | input | `pixel_values` | [1, 3, 224, 224] | fp16 |
40
+ | input | `input_ids` | [3, 77] | int32 |
41
+ | input | `attention_mask` | [3, 77] | int32 |
42
+ | output | `image_embeds` | [1, 512] | fp16, L2-normalized |
43
+ | output | `text_embeds` | [3, 512] | fp16, L2-normalized |
44
+ | output | `logits_per_image` / `logits_per_text` | [1, 3] / [3, 1] | fp16 |
45
+
46
+ Preprocessing: 224×224 resize + CLIP mean/std normalization (handled by
47
+ `ImageTextEncoder`).
48
+
49
+ ## Performance
50
+
51
+ M4 Max: ~3.7 ms per image on the Neural Engine (fp16). Requires macOS 27 beta /
52
+ iOS 27 beta (device — the CoreAI framework is not in the iOS Simulator SDK).
53
+
54
+ ## License
55
+
56
+ Model weights: MIT (OpenAI CLIP); see the upstream repo. Export recipe:
57
+ BSD-3-Clause (apple/coreai-models).
model/clip-vit-base-patch32_float16_static.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ � M����X$'r$�ĬK̖�����_�2��>h
model/clip-vit-base-patch32_float16_static.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4094dfea3cfc7582427721e24eac4ac4bcc9619b983fafdad5ff432a0933e68
3
+ size 302771548
model/clip-vit-base-patch32_float16_static.aimodel/metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "license" : "MIT",
3
+ "author" : "A. Radford et al.",
4
+ "creationDate" : "20260611T225847Z",
5
+ "description" : "CLIP (Contrastive Language-Image Pretraining) learns joint representations of images and text, enabling zero-shot image classification with natural language labels. Source: https:\/\/huggingface.co\/openai\/clip-vit-base-patch32",
6
+ "assetVersion" : "2.0"
7
+ }
model/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff