delavalom commited on
Commit
8036f0b
·
verified ·
1 Parent(s): bac0402

EmbeddingGemma 2 Core ML v1.0.0

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ 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
+ b280/EmbeddingGemma2.aar filter=lfs diff=lfs merge=lfs -text
37
+ b280/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ b70/EmbeddingGemma2.aar filter=lfs diff=lfs merge=lfs -text
39
+ b70/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ embeddinggemma-coreml
2
+ Copyright 2026 Delavalom
3
+
4
+ This product includes software developed by third parties:
5
+
6
+ - EmbeddingGemma 2 (google/embeddinggemma-2, revision
7
+ 914f7f89142e33e77833254d9c9b90c3cef7303b), model weights, architecture and
8
+ tokenizer, by Google DeepMind, licensed under the Apache License, Version 2.0.
9
+ https://huggingface.co/google/embeddinggemma-2
10
+ The Core ML model published from this repository (EmbeddingGemma2.mlpackage)
11
+ is a modified version of those weights. Modified by Delavalom, 2026:
12
+ re-implemented in PyTorch, converted to Core ML, cast to FP16, and compressed
13
+ (int8 per-channel convolution weights, int4 per-block embedding table). The
14
+ tokenizer files are redistributed unmodified.
15
+ The upstream model card states: "Deployments must adhere to the Gemma
16
+ Prohibited Use Policy" (https://ai.google.dev/gemma/prohibited_use_policy).
17
+
18
+ - Reference code in vendor/reference/ is copied unmodified from Hugging Face
19
+ Transformers, Copyright The Hugging Face Team, licensed under the Apache
20
+ License, Version 2.0. It is kept for reading only and is never imported.
21
+ https://github.com/huggingface/transformers (see vendor/reference/SOURCE.txt
22
+ for the exact commit).
23
+
24
+ - tests/upstream.py is a modified copy of functions from the same Hugging Face
25
+ Transformers release (v5.20.2: modeling_gemma4.py,
26
+ modeling_embedding_gemma2.py, image_processing_gemma4.py), Copyright The
27
+ Hugging Face Team, licensed under the Apache License, Version 2.0. Modified by
28
+ Delavalom, 2026: the minimal functions were extracted into one test-only
29
+ module, with config lookups replaced by arguments; the maths is unchanged.
30
+ It is used only as a test oracle and is not shipped.
31
+
32
+ - tests/upstream_towers.py is a modified copy of the tower modules from the same
33
+ release (modeling_embedding_gemma2.py, modeling_gemma4.py,
34
+ image_processing_gemma4.py), Copyright The Hugging Face Team, licensed under
35
+ the Apache License, Version 2.0. Modified by Delavalom, 2026: config objects
36
+ replaced by arguments, masks built inline, no output records or kernels; the
37
+ maths is unchanged. It is used only as a test oracle and is not shipped.
README.md ADDED
@@ -0,0 +1,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: google/embeddinggemma-2
4
+ base_model_relation: quantized
5
+ library_name: coreml
6
+ pipeline_tag: feature-extraction
7
+ tags: [coreml, embeddings, multimodal-embedding, image-text, sentence-similarity, ios, macos, neural-engine]
8
+ ---
9
+
10
+ <!-- Rendered by stages/s7_publish (card.py + model_card.md) from the stage reports. Do not edit on the Hub. -->
11
+
12
+ # EmbeddingGemma 2 for Core ML
13
+
14
+ This is [`google/embeddinggemma-2`](https://huggingface.co/google/embeddinggemma-2) (Google DeepMind's text and image embedding model, one
15
+ shared 768-d space) converted to **multifunction Core ML models that run on the Apple Neural Engine**, one per image
16
+ budget. Every stage of the conversion was checked against the original PyTorch model. It is an unofficial conversion. It is not made or
17
+ endorsed by Google.
18
+
19
+ - **Base model:** `google/embeddinggemma-2` at revision `914f7f89142e33e77833254d9c9b90c3cef7303b` (`model.safetensors` sha256 `197a32965d4b1105faf060417baa899e193fb73cd401f42ec9295234d5553d79`).
20
+ - **Modalities:** text and images. Audio and video are not converted.
21
+ - **Variant shipped:** `int8_table4`: int8 per-channel conv weights, int4 per-block (32) table; tables and norms FP16.
22
+ - **Layout:** one folder per image budget, `b70/` and `b280/`. Each holds the text functions and that budget's image
23
+ functions; a device uses one budget only, so it downloads one folder's archive.
24
+ - **Size:** apps download one file, `b<budget>/EmbeddingGemma2.aar` (an LZFSE Apple Archive of the package and the tokenizer:
25
+ 343.2 MB for budget 70, 352.9 MB for budget 280; the s4 gate is 360 MB for the
26
+ larger), described by `b<budget>/manifest.json` (size, SHA-256 and image budget). Unpacked it is 435.0 /
27
+ 454.9 MB; the package alone is 402.8 / 422.8 MB. The same files are also in each
28
+ folder unpacked, each listed with its size and SHA-256 in `b<budget>/files.json`.
29
+ - **Runs on:** iOS 18+ and macOS 15+ (the model uses `ios18` ops). It is built for `.cpuAndNeuralEngine`.
30
+ - **Swift package:** [`EmbeddingGemma`](https://github.com/Delavalom/embeddinggemma-coreml) (download, verification,
31
+ tokenizer, image preprocessing, plus an on-disk vector index). See "Use from Swift" below.
32
+
33
+ ## License and terms
34
+
35
+ - **The weights in this repo are a modified version of `google/embeddinggemma-2`, under the Apache License, Version 2.0.**
36
+ This is the license the upstream model card declares at the pinned revision (`license: apache-2.0`, linking
37
+ Google's [Gemma 4 license](https://ai.google.dev/gemma/docs/gemma_4_license), which is the Apache 2.0 text).
38
+ The original model is by Google DeepMind. See `LICENSE` (the full Apache 2.0 text) and `NOTICE`.
39
+ - **Changes made (Apache 2.0, section 4(b)):** the original weights were re-implemented in PyTorch, converted to Core
40
+ ML, cast to FP16, and compressed (int8 per-channel convolution weights, int4 per-block embedding table). The
41
+ vectors are close to the original's but not identical (see "Accuracy").
42
+ - **Upstream use policy, passed through:** the upstream model card says *"Deployments must adhere to the
43
+ [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy)."* That requirement comes from
44
+ the upstream model, and it applies to this conversion too. The upstream card also says developers are responsible
45
+ for application-level safeguards (retrieval filtering, fairness testing) suited to their use case. Read
46
+ Google's [model card](https://huggingface.co/google/embeddinggemma-2) for its intended uses, limitations and ethical
47
+ considerations. They all apply here.
48
+ - The tokenizer files (`tokenizer/tokenizer.json`, `tokenizer/tokenizer_config.json`) are unmodified copies from
49
+ the upstream revision above.
50
+ - The conversion code and the Swift package are Apache-2.0 too (the GitHub repo's `LICENSE` and `NOTICE`).
51
+
52
+ ## Functions
53
+
54
+ One `.mlpackage` per image budget, `b70/EmbeddingGemma2.mlpackage` and `b280/EmbeddingGemma2.mlpackage`, each with
55
+ nine functions with fixed shapes: the four text functions (the same in both) and the five image functions of its
56
+ budget. Both were split from one 14-function package, and every function gives the same output bytes as there.
57
+ Every function returns `embedding`, float32 `[1, 768]`, L2-normalized.
58
+
59
+ | function | input | tokens |
60
+ |---|---|---|
61
+ | `embed_text_16`, `_32`, `_64`, `_128` | `input_ids` int32 `[1, L]`, `attention_mask` int32 `[1, L]` (1 = token, 0 = padding) | L = 16 / 32 / 64 / 128 |
62
+ | `embed_image_70_{tall,portrait,square,landscape,wide}` (in `b70/`) | `pixels` `[1, 3, H, W]`, RGB in 0-1 | 60-70 image tokens |
63
+ | `embed_image_280_{tall,portrait,square,landscape,wide}` (in `b280/`) | `pixels` `[1, 3, H, W]`, RGB in 0-1 | 256-280 image tokens |
64
+
65
+ Image shapes (H x W). The bucket comes from the aspect ratio r = width / height: tall r < 0.6, portrait r < 0.83,
66
+ square r <= 1.2, landscape r <= 1.67, wide above that.
67
+
68
+ | budget | tall | portrait | square | landscape | wide |
69
+ |---|---|---|---|---|---|
70
+ | 70 | 576 x 240 | 480 x 336 | 384 x 384 | 336 x 480 | 240 x 576 |
71
+ | 280 | 1152 x 528 | 960 x 672 | 768 x 768 | 672 x 960 | 528 x 1152 |
72
+
73
+ - **Text** is `<bos>` + tokens(prompt + text) + `<eos>`, padded with `<pad>` (id 0) to the smallest length that
74
+ fits. Longer inputs are cut to 128 tokens, keeping `<bos>` and `<eos>` (the upstream model allows up to 8K
75
+ tokens). Use the upstream prompts: `task: search result | query: ` for queries, `title: none | text: ` for
76
+ documents (also `task: classification | query: ` and `task: clustering | query: `).
77
+ - **Images** are resized straight to the bucket size (no crop or padding). Use 8-bit sRGB, antialiased bicubic
78
+ resampling, and scale by 1/255 with no mean or std normalization, as the reference processor does. The Swift
79
+ package does this.
80
+ - **Matryoshka:** you can truncate the 768-d output to 512, 256 or 128 dims and re-normalize. The Swift package
81
+ defaults to 256. All accuracy numbers below are at 768 dims.
82
+
83
+ ## Accuracy against the original model
84
+
85
+ Measured by the pipeline on 200 hand-written texts (120 of them search queries) and 200 images (CC0 and public
86
+ domain photos from Wikimedia Commons, plus synthetic screenshots, memes and receipts; 14 categories), at both image
87
+ budgets. Cosine values are the **minimum** over all inputs, not the mean.
88
+
89
+ | stage | what is compared | min cosine, text | min cosine, image |
90
+ |---|---|---|---|
91
+ | s1 | our PyTorch rewrite (FP32) vs the official `sentence-transformers` model | 1 - 1.4e-12 | 1 - 1.0e-08 |
92
+ | s2 | Core ML FP32 vs the official model | 1 - 1.2e-12 | 1 - 1.9e-08 |
93
+ | s3 | Core ML FP16 on the Neural Engine vs the official model (at least 99.86% of ops on the Neural Engine) | 0.99996 | 0.99404 (1st percentile 0.99848) |
94
+ | s4 | **shipped `int8_table4`** on `CPU_AND_NE` vs the official model | **0.99791** | **0.99133** (1st percentile 0.99539) |
95
+ | s5 | the Swift package end to end on a Mac (tokenizer + preprocessing + model) vs the official model on the same decoded pixels; vs Python Core ML on identical inputs: 1 - 1.0e-15 | 0.99017 (text and image) | |
96
+
97
+ Retrieval with the shipped variant (the 120 queries ranking the 200 images, budget 70 / 280):
98
+
99
+ | metric | budget 70 | budget 280 |
100
+ |---|---|---|
101
+ | text-to-image recall@10 vs the FP reference on the same bucketed images | 0.962 | 0.966 |
102
+ | 5th-percentile Spearman of the top 50, same reference | 0.966 | 0.972 |
103
+ | text-to-image recall@10 vs the exact-aspect FP model (recorded, not gated) | 0.844 | 0.874 |
104
+
105
+ For 98.3% of queries (worst budget), the exact-aspect model's top-1 image is in the shipped model's top
106
+ 10. Image-to-image precision@10 by category label is at most 0.012 below the exact-aspect FP model.
107
+ Swift tokenization matches the reference ids for every fixture text (`True`). The 99th-percentile pixel
108
+ difference against the reference preprocessing is 0.000000 (0-1 units).
109
+
110
+ **Caveats:**
111
+
112
+ - **The retrieval gates use a bucketed FP reference.** The upstream processor resizes each image to its own
113
+ aspect-preserving size. This model has five fixed shapes per budget, so even with no compression, the bucketed
114
+ vector differs from the exact-aspect one (min cosine 0.916 at budget 70, 0.893 at 280).
115
+ That is why recall@10 against the exact-aspect model is lower than recall@10 against the bucketed reference. The
116
+ compression and FP16 gates (min cosine >= 0.99, recall@10 >= 0.95, Spearman >= 0.9) are therefore measured
117
+ against the FP model on the same bucketed images. Bucketing gets its own task-level gates (top-1 in top 10
118
+ >= 0.95, category precision@10 drop <= 0.03). Measured by category labels, bucketing costs no retrieval
119
+ quality. Details: ADR-0007 in the GitHub repo.
120
+ - **Two images fall below the FP16 bar on the Neural Engine.** In FP16 on the Neural Engine, fixture images i141
121
+ and i161 reach 0.99404 / 0.99405 cosine. The other 398 are at 0.998 or above. On the GPU these two images pass,
122
+ but the GPU is 2.8x slower at budget 70. They change the top 10 of only a few queries: with only those two
123
+ vectors swapped in, recall@10 stays at 0.9975 (budget 70) and 0.9992 (budget 280). They were accepted at task
124
+ level, and images stay on the Neural Engine. The lowest image cosines of the shipped variant are i161 0.99133 (`embed_image_280_landscape`), i141 0.99322 (`embed_image_70_wide`), i165 0.99336 (`embed_image_280_portrait`).
125
+ Details: ADR-0006.
126
+ - The test set is small: 200 texts, 200 images. Multilingual text, code and long documents were not tested
127
+ separately. For quality on standard benchmarks, see Google's model card. This conversion only claims closeness
128
+ to the original.
129
+
130
+ ## Speed and memory
131
+
132
+ **Mac** (s4, `CPU_AND_NE`, median of 20 runs after warm-up). These were measured on the build Mac; the v1.0.0
133
+ build Mac is an M1 Pro with macOS 26. `embed_text_16` takes 4.4 ms and `embed_image_70_square` takes
134
+ 43.8 ms. In every function, at least 99.81% of the ops are placed on the Neural Engine (`MLComputePlan`, minimum
135
+ over the 14 functions, measured on the package the two budget packages were split from).
136
+
137
+ **iPhone** (s6, PhotoSearchDemo's benchmark: each iPhone runs its own budget, `ImageBudget.auto`, 280 on A17 Pro
138
+ and newer and 70 otherwise: the newest 1,000 photos at 70 or 200 at 280, and 20 queries; times cover preprocessing +
139
+ prediction):
140
+
141
+ | device | iOS | ms per image, 70 (median) | ms per image, 280 (median) | ms per query (median) | peak memory, MB |
142
+ |---|---|---|---|---|---|
143
+ | iPhone14,3 | 27.0.1 | 64.0 | not run | 6.7 | 630 |
144
+
145
+ Worst device: 64.0 ms per image at 70, not measured (no A17 Pro or newer iPhone ran s6 yet) at 280, 6.7 ms per query, peak 630 MB (the
146
+ gate is 800 MB; the target for budget 70 is 60 ms, which is recorded, not gated).
147
+
148
+ **Storage:** the Swift package downloads the archive of the device's image budget, `b<budget>/EmbeddingGemma2.aar`
149
+ (343.2 MB at 70, 352.9 MB at 280, resumable), checks its size and SHA-256 against
150
+ `b<budget>/manifest.json`, unpacks it (435.0 / 454.9 MB) with the AppleArchive framework and
151
+ compiles the package. It needs free space for the archive, the unpacked files and the compiled model while it
152
+ installs; afterwards it keeps the compiled model and the tokenizer. The s4 gate measures the larger archive,
153
+ 352.9 MB (limit 360 MB).
154
+
155
+ ## Use from Swift
156
+
157
+ ```swift
158
+ // Package.swift: .package(url: "https://github.com/Delavalom/embeddinggemma-coreml", from: "1.0.0")
159
+ import EmbeddingGemma
160
+ import EmbeddingIndex
161
+
162
+ let model = try await EmbeddingGemma.load(.huggingFace(revision: EmbeddingGemma.defaultRevision))
163
+ let photo = try await model.embed(image: cgImage, orientation: .up) // [Float], 256-d by default, normalized
164
+ let query = try await model.embed(query: "receipts from last week")
165
+ ```
166
+
167
+ The package pins this repo (`delavalom/embeddinggemma-2-coreml`) at a commit and the SHA-256 of each budget's `manifest.json`, which pins its
168
+ archive's size and SHA-256. `budget: .auto` picks 280 tokens on A17 Pro and newer iPhones and on Macs, and 70 on
169
+ other devices, and loads that budget's folder (`b280/` or `b70/`) only.
170
+
171
+ ## Use from Python (coremltools, macOS 15+)
172
+
173
+ ```python
174
+ import numpy as np, coremltools as ct
175
+ from tokenizers import Tokenizer
176
+ from torchvision.transforms.functional import pil_to_tensor, resize, InterpolationMode
177
+ from PIL import Image
178
+
179
+ BUDGET = 280 # the folder you downloaded: b280/ or b70/; its text functions are the same in both
180
+ PKG = f"b{BUDGET}/EmbeddingGemma2.mlpackage"
181
+ tok = Tokenizer.from_file(f"b{BUDGET}/tokenizer/tokenizer.json")
182
+ # self-check: the layout the model was traced with is <bos> ... <eos>
183
+ assert tok.encode("task: search result | query: screenshots of tweets").ids == \
184
+ [2, 8071, 236787, 3927, 1354, 1109, 7609, 236787, 75490, 529, 46331, 1]
185
+
186
+ def fn(name):
187
+ return ct.models.MLModel(PKG, function_name=name, compute_units=ct.ComputeUnit.CPU_AND_NE)
188
+
189
+ def embed_text(text, prompt="task: search result | query: "):
190
+ ids = tok.encode(prompt + text).ids
191
+ ids = ids if len(ids) <= 128 else ids[:127] + [ids[-1]]
192
+ n = next(L for L in (16, 32, 64, 128) if L >= len(ids))
193
+ x = np.zeros((1, n), np.int32); x[0, :len(ids)] = ids
194
+ m = np.zeros((1, n), np.int32); m[0, :len(ids)] = 1
195
+ return fn(f"embed_text_{n}").predict({"input_ids": x, "attention_mask": m})["embedding"][0]
196
+
197
+ SHAPES = {70: {"tall": (576, 240), "portrait": (480, 336), "square": (384, 384), "landscape": (336, 480),
198
+ "wide": (240, 576)},
199
+ 280: {"tall": (1152, 528), "portrait": (960, 672), "square": (768, 768), "landscape": (672, 960),
200
+ "wide": (528, 1152)}}
201
+
202
+ def bucket(r): # r = width / height
203
+ return ("tall" if r < 0.6 else "portrait" if r < 0.83 else "square" if r <= 1.2
204
+ else "landscape" if r <= 1.67 else "wide")
205
+
206
+ def embed_image(path):
207
+ img = Image.open(path).convert("RGB") # like the reference: 8-bit RGB, ICC profile ignored
208
+ name = bucket(img.width / img.height)
209
+ px = resize(pil_to_tensor(img), list(SHAPES[BUDGET][name]), InterpolationMode.BICUBIC, antialias=True)
210
+ px = px.float() / 255
211
+ return fn(f"embed_image_{BUDGET}_{name}").predict({"pixels": px[None].numpy()})["embedding"][0]
212
+
213
+ def truncate(v, dims=256): # Matryoshka
214
+ v = v[:dims]; return v / np.linalg.norm(v)
215
+ ```
216
+
217
+ The model is compiled each time `MLModel` is created. To make many calls, keep one instance per function. The
218
+ Python path is not gated; the gated path is the Swift package (s5).
219
+
220
+ ## Reproducibility
221
+
222
+ The model was built by an 8-stage pipeline in the GitHub repo. Each stage writes `artifacts/<stage>/report.json`,
223
+ which is checked against `gates.toml`. A stage counts only if its report passed and is current. Each report
224
+ records `git_sha` and `code_hash` (sha256 over the stage's code, the lock file and its gate table), and
225
+ `inputs_sha256` chains it to the reports it read. The reports behind this release:
226
+
227
+ | stage | status | git_sha | code_hash |
228
+ |---|---|---|---|
229
+ | s0_reference | passed | `59b9bf9863cb` | `9a6a53c2abe21038` |
230
+ | s1_rewrite | passed | `7645eff4d951` | `e98a54bc6bbc6abf` |
231
+ | s2_coreml_fp32 | passed | `82b02a4da1ec` | `21bb94d9d33d0230` |
232
+ | s3_coreml_ane | passed | `8e33af79825f` | `edb80276335be2a4` |
233
+ | s4_compress | passed | `b9064e9abb2b` | `e68c9ca0822062d0` |
234
+ | s5_swift | passed | `90679438068a` | `464d01a178d66eb5` |
235
+ | s6_device | passed | `d5b2e6edc33e` | `70b253e29d57b0ce` |
236
+
237
+ Reference environment: transformers 5.20.2, sentence-transformers 6.2.0; conversion:
238
+ coremltools 9.0. To rebuild: `just setup`, then `just stage 0` through `just stage 5` (`just stage 6` needs
239
+ an iPhone). Numbers measured on the CPU and the Neural Engine can
240
+ vary slightly from run to run.
241
+
242
+ # Results
243
+
244
+ Generated by `python -m scripts.gen_results` from `artifacts/*/report.json` and `docs/results/*.json`. Do not edit by hand.
245
+
246
+ Model: `google/embeddinggemma-2` at revision `914f7f89142e33e77833254d9c9b90c3cef7303b`.
247
+
248
+ ## Gates
249
+
250
+ | stage | status | metric | value | gate | ok |
251
+ |---|---|---|---|---|---|
252
+ | s0_reference | passed | license_apache | true | == true | yes |
253
+ | s0_reference | passed | key_inventory_written | true | == true | yes |
254
+ | s0_reference | passed | deterministic | true | == true | yes |
255
+ | s1_rewrite | passed | strict_load | true | == true | yes |
256
+ | s1_rewrite | passed | min_cosine_text | 1 - 1.4e-12 | >= 0.9999 | yes |
257
+ | s1_rewrite | passed | min_cosine_image | 1 - 1e-08 | >= 0.9999 | yes |
258
+ | s2_coreml_fp32 | passed | min_cosine_text | 1 - 1.2e-12 | >= 0.9999 | yes |
259
+ | s2_coreml_fp32 | passed | min_cosine_image | 1 - 1.9e-08 | >= 0.9999 | yes |
260
+ | s3_coreml_ane | passed | min_cosine_text | 0.999965 | >= 0.995 | yes |
261
+ | s3_coreml_ane | passed | min_cosine_image | 0.994037 | >= 0.99 | yes |
262
+ | s3_coreml_ane | passed | min_p1_cosine_image | 0.998482 | >= 0.995 | yes |
263
+ | s3_coreml_ane | passed | min_recall_at_10 | 0.9675 | >= 0.95 | yes |
264
+ | s3_coreml_ane | passed | min_p5_spearman_top50 | 0.987025 | >= 0.9 | yes |
265
+ | s3_coreml_ane | passed | min_ane_fraction | 0.99864 | >= 0.95 | yes |
266
+ | s4_compress | passed | min_cosine | 0.991329 | >= 0.99 | yes |
267
+ | s4_compress | passed | min_recall_at_10 | 0.961667 | >= 0.95 | yes |
268
+ | s4_compress | passed | min_p5_spearman_top50 | 0.966043 | >= 0.9 | yes |
269
+ | s4_compress | passed | min_t2i_top1_in_top10 | 0.983333 | >= 0.95 | yes |
270
+ | s4_compress | passed | max_i2i_label_p10_drop | 0.012 | <= 0.03 | yes |
271
+ | s4_compress | passed | max_download_mb | 352.911 | <= 360 | yes |
272
+ | s5_swift | passed | token_ids_identical | true | == true | yes |
273
+ | s5_swift | passed | max_pixel_abs_diff | 0 | <= 0.003922 | yes |
274
+ | s5_swift | passed | min_cosine_runtime | 1 - 1e-15 | >= 0.9999 | yes |
275
+ | s5_swift | passed | min_cosine | 0.990173 | >= 0.99 | yes |
276
+ | s5_swift | passed | min_recall_at_10 | 0.9575 | >= 0.95 | yes |
277
+ | s5_swift | passed | min_p5_spearman_top50 | 0.96449 | >= 0.9 | yes |
278
+ | s5_swift | passed | min_t2i_top1_in_top10 | 0.983333 | >= 0.95 | yes |
279
+ | s5_swift | passed | max_i2i_label_p10_drop | 0.0065 | <= 0.03 | yes |
280
+ | s6_device | passed | max_peak_rss_mb | 630.065 | <= 800 | yes |
281
+ | s6_device | passed | max_cold_compile_peak_mb | 1517.66 | <= 2100 | yes |
282
+ | s6_device | passed | min_devices | 1 | >= 1 | yes |
283
+ | s7_publish | not run | - | - | - | - |
284
+
285
+ ## s4 variants
286
+
287
+ Chosen: `int8_table4` (winner: `int8_table4`). Variants are tried smallest first; the first that passes every gate wins, so later ones may not have run. Download limit: 360 MB.
288
+
289
+ | variant | download MB | package MB | min cosine | recall@10 | p5 Spearman top-50 | exact-aspect top-1 in top 10 | i2i p@10 drop | min ANE fraction | recall@10 vs exact-aspect | passes | description |
290
+ |---|---|---|---|---|---|---|---|---|---|---|---|
291
+ | int8_table4 | 358.669 | 452.4 | 0.991329 | 0.961667 | 0.966043 | 0.983333 | 0.012 | 0.998131 | 0.844167 | all | int8 per-channel conv weights, int4 per-block (32) table; tables and norms FP16 |
292
+
293
+ Shipped per image budget (download MB = the device archive; `max_download_mb` is the larger): budget 70 `EmbeddingGemma2-b70.aar` 343.178 MB (9 functions), budget 280 `EmbeddingGemma2-b280.aar` 352.911 MB (9 functions). Same outputs as the 14-function package (CPU_ONLY, bitwise): True.
294
+
295
+ ## s5 Swift parity
296
+
297
+ Pixels (0-1 units; PNG and synthetic are gated, JPEG includes the decoder and is recorded only, ADR-0004):
298
+
299
+ | inputs | p99 | max | bit-exact |
300
+ |---|---|---|---|
301
+ | png | 0 | 0 | 60/60 |
302
+ | synthetic | 0 | 0 | 20/20 |
303
+ | jpeg | 0.00784314 | 0.121569 | 0/340 |
304
+
305
+ | comparison | min cosine | recall@10 (worst budget) | p5 Spearman top-50 |
306
+ |---|---|---|---|
307
+ | Swift vs Python Core ML, same inputs (gated) | 1 - 1e-15 | - | - |
308
+ | Swift vs FP reference on Swift's pixels (gated) | 0.990173 | 0.9575 | 0.96449 |
309
+ | Swift vs s0 (recorded) | 0.971191 | 0.946667 | 0.952845 |
310
+ | FP on Swift's pixels vs s0: the decoder (recorded) | 0.971614 | 0.968333 | 0.969143 |
311
+
312
+ Against s0 (recorded only; on JPEGs it includes the decoder, ADR-0008):
313
+
314
+ | vectors | n | min cosine | mean cosine |
315
+ |---|---|---|---|
316
+ | text query | 120 | 0.998874 | 0.99951 |
317
+ | text document | 80 | 0.997913 | 0.999262 |
318
+ | image 70_jpeg | 170 | 0.978874 | 0.999002 |
319
+ | image 70_png | 30 | 0.995402 | 0.99898 |
320
+ | image 280_jpeg | 170 | 0.971191 | 0.998763 |
321
+ | image 280_png | 30 | 0.999682 | 0.999764 |
322
+
323
+ ## Device benchmarks (s6)
324
+
325
+ | source | device | status | key metrics |
326
+ |---|---|---|---|
327
+ | artifacts/s6_device/report.json | iPhone14,3 | passed | max_peak_rss_mb=630.065, max_cold_compile_peak_mb=1517.66, min_devices=1 |
328
+ | docs/results/s6_iPhone14,3.json | iPhone14,3 | passed | max_peak_rss_mb=630.065, max_cold_compile_peak_mb=1517.66, min_devices=1 |
329
+
330
+ ## Limitations
331
+
332
+ - Text and images only. Text is limited to 128 tokens; images are limited to budgets of 70 or 280 tokens and five
333
+ fixed aspect buckets each.
334
+ - Results are close to the original model, not bit-identical (see "Accuracy"). Do not mix vectors from this model
335
+ with vectors from the PyTorch model or another conversion in the same index. The Swift index stores the model
336
+ revision for that reason.
337
+ - Intel Macs have no Neural Engine; they run on the CPU/GPU and are slower. The fastest settings are on the Neural
338
+ Engine with `.cpuAndNeuralEngine`.
339
+ - The first load compiles the model on the device, which takes a while. The Swift package caches the compiled
340
+ model.
341
+ - Everything in the upstream card's "Limitations" and "Ethical Considerations and Risks" applies.
342
+
343
+ ## Citation
344
+
345
+ Please cite the original model as Google DeepMind's model card asks
346
+ ([`google/embeddinggemma-2`](https://huggingface.co/google/embeddinggemma-2)). For this conversion:
347
+
348
+ ```bibtex
349
+ @software{embeddinggemma_coreml,
350
+ title = {EmbeddingGemma 2 for Core ML},
351
+ author = {Delavalom},
352
+ year = {2026},
353
+ url = {https://huggingface.co/delavalom/embeddinggemma-2-coreml},
354
+ note = {Core ML conversion of google/embeddinggemma-2}
355
+ }
356
+ ```
b280/EmbeddingGemma2.aar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0a74ee7d93352cdb408598345d5411618ad371cc186439c4971d075f22946d5
3
+ size 352911045
b280/EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40e022e90eb0a4d29452332d8630d79f8614e4cf3e518481c03ef20c67ccfef1
3
+ size 29563081
b280/EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c4f80819587b8b3ba04a29c71f510251846a10d7a1a90a9ea5687c1b2ceb597
3
+ size 393212800
b280/EmbeddingGemma2.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "1600A8CB-5C2B-4582-8E73-9F5987BC21F6": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Weights",
7
+ "name": "weights",
8
+ "path": "com.apple.CoreML/weights"
9
+ },
10
+ "E7DBE403-39AC-4782-8EB5-C8366FF70BDA": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Specification",
13
+ "name": "model.mlmodel",
14
+ "path": "com.apple.CoreML/model.mlmodel"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "E7DBE403-39AC-4782-8EB5-C8366FF70BDA"
18
+ }
b280/files.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "path": "EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/model.mlmodel",
4
+ "sha256": "40e022e90eb0a4d29452332d8630d79f8614e4cf3e518481c03ef20c67ccfef1",
5
+ "size": 29563081
6
+ },
7
+ {
8
+ "path": "EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/weights/weight.bin",
9
+ "sha256": "4c4f80819587b8b3ba04a29c71f510251846a10d7a1a90a9ea5687c1b2ceb597",
10
+ "size": 393212800
11
+ },
12
+ {
13
+ "path": "EmbeddingGemma2.mlpackage/Manifest.json",
14
+ "sha256": "eb18d1aeb58728c3321d3184d6b759da65b14c0e613c4922debbb7341c37e210",
15
+ "size": 617
16
+ },
17
+ {
18
+ "path": "tokenizer/tokenizer.json",
19
+ "sha256": "4d777ef5bdc1aa36227abdfb77c3e49e7b9c892d16e1b6bda41c393504828be4",
20
+ "size": 32170510
21
+ },
22
+ {
23
+ "path": "tokenizer/tokenizer_config.json",
24
+ "sha256": "17bd5d6e9364ca49a534e1502076593317c298d4a663623091ed45388f004874",
25
+ "size": 1599
26
+ }
27
+ ]
b280/manifest.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "archive": "EmbeddingGemma2.aar",
3
+ "format": 1,
4
+ "functions": [
5
+ "embed_image_280_landscape",
6
+ "embed_image_280_portrait",
7
+ "embed_image_280_square",
8
+ "embed_image_280_tall",
9
+ "embed_image_280_wide",
10
+ "embed_text_128",
11
+ "embed_text_16",
12
+ "embed_text_32",
13
+ "embed_text_64"
14
+ ],
15
+ "image_budget": 280,
16
+ "revision": "v1.0.0",
17
+ "sha256": "a0a74ee7d93352cdb408598345d5411618ad371cc186439c4971d075f22946d5",
18
+ "size": 352911045,
19
+ "unpacked_size": 454948607
20
+ }
b280/tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d777ef5bdc1aa36227abdfb77c3e49e7b9c892d16e1b6bda41c393504828be4
3
+ size 32170510
b280/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_token": "<|audio|>",
3
+ "backend": "tokenizers",
4
+ "boa_token": "<|audio>",
5
+ "boi_token": "<|image>",
6
+ "bos_token": "<bos>",
7
+ "eoa_token": "<audio|>",
8
+ "eoc_token": "<channel|>",
9
+ "eoi_token": "<image|>",
10
+ "eos_token": "<eos>",
11
+ "eot_token": "<turn|>",
12
+ "escape_token": "<|\"|>",
13
+ "etc_token": "<tool_call|>",
14
+ "etd_token": "<tool|>",
15
+ "etr_token": "<tool_response|>",
16
+ "extra_special_tokens": [
17
+ "<|video|>"
18
+ ],
19
+ "image_token": "<|image|>",
20
+ "is_local": true,
21
+ "local_files_only": false,
22
+ "mask_token": "<mask>",
23
+ "model_max_length": 1000000000000000019884624838656,
24
+ "model_specific_special_tokens": {
25
+ "audio_token": "<|audio|>",
26
+ "boa_token": "<|audio>",
27
+ "boi_token": "<|image>",
28
+ "eoa_token": "<audio|>",
29
+ "eoc_token": "<channel|>",
30
+ "eoi_token": "<image|>",
31
+ "eot_token": "<turn|>",
32
+ "escape_token": "<|\"|>",
33
+ "etc_token": "<tool_call|>",
34
+ "etd_token": "<tool|>",
35
+ "etr_token": "<tool_response|>",
36
+ "image_token": "<|image|>",
37
+ "soc_token": "<|channel>",
38
+ "sot_token": "<|turn>",
39
+ "stc_token": "<|tool_call>",
40
+ "std_token": "<|tool>",
41
+ "str_token": "<|tool_response>",
42
+ "think_token": "<|think|>",
43
+ "video_token": "<|video|>"
44
+ },
45
+ "pad_token": "<pad>",
46
+ "padding_side": "right",
47
+ "processor_class": "EmbeddingGemma2Processor",
48
+ "soc_token": "<|channel>",
49
+ "sot_token": "<|turn>",
50
+ "stc_token": "<|tool_call>",
51
+ "std_token": "<|tool>",
52
+ "str_token": "<|tool_response>",
53
+ "think_token": "<|think|>",
54
+ "tokenizer_class": "GemmaTokenizer",
55
+ "unk_token": "<unk>",
56
+ "video_token": "<|video|>"
57
+ }
b70/EmbeddingGemma2.aar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57011c9f3d7ac190efe3c89c205eef416a3cda8c2bea8f8647c404d57397a1b0
3
+ size 343177992
b70/EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89d4bf697bbd293e4ffd9976b86a1cc14f5fe398969d51438f6c017edf4bca62
3
+ size 29531716
b70/EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3926720d87d28bb37be007f7d6c1015707636a95c01b247b91e095a30c5845c9
3
+ size 373281792
b70/EmbeddingGemma2.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "1600A8CB-5C2B-4582-8E73-9F5987BC21F6": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Weights",
7
+ "name": "weights",
8
+ "path": "com.apple.CoreML/weights"
9
+ },
10
+ "E7DBE403-39AC-4782-8EB5-C8366FF70BDA": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Specification",
13
+ "name": "model.mlmodel",
14
+ "path": "com.apple.CoreML/model.mlmodel"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "E7DBE403-39AC-4782-8EB5-C8366FF70BDA"
18
+ }
b70/files.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "path": "EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/model.mlmodel",
4
+ "sha256": "89d4bf697bbd293e4ffd9976b86a1cc14f5fe398969d51438f6c017edf4bca62",
5
+ "size": 29531716
6
+ },
7
+ {
8
+ "path": "EmbeddingGemma2.mlpackage/Data/com.apple.CoreML/weights/weight.bin",
9
+ "sha256": "3926720d87d28bb37be007f7d6c1015707636a95c01b247b91e095a30c5845c9",
10
+ "size": 373281792
11
+ },
12
+ {
13
+ "path": "EmbeddingGemma2.mlpackage/Manifest.json",
14
+ "sha256": "eb18d1aeb58728c3321d3184d6b759da65b14c0e613c4922debbb7341c37e210",
15
+ "size": 617
16
+ },
17
+ {
18
+ "path": "tokenizer/tokenizer.json",
19
+ "sha256": "4d777ef5bdc1aa36227abdfb77c3e49e7b9c892d16e1b6bda41c393504828be4",
20
+ "size": 32170510
21
+ },
22
+ {
23
+ "path": "tokenizer/tokenizer_config.json",
24
+ "sha256": "17bd5d6e9364ca49a534e1502076593317c298d4a663623091ed45388f004874",
25
+ "size": 1599
26
+ }
27
+ ]
b70/manifest.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "archive": "EmbeddingGemma2.aar",
3
+ "format": 1,
4
+ "functions": [
5
+ "embed_image_70_landscape",
6
+ "embed_image_70_portrait",
7
+ "embed_image_70_square",
8
+ "embed_image_70_tall",
9
+ "embed_image_70_wide",
10
+ "embed_text_128",
11
+ "embed_text_16",
12
+ "embed_text_32",
13
+ "embed_text_64"
14
+ ],
15
+ "image_budget": 70,
16
+ "revision": "v1.0.0",
17
+ "sha256": "57011c9f3d7ac190efe3c89c205eef416a3cda8c2bea8f8647c404d57397a1b0",
18
+ "size": 343177992,
19
+ "unpacked_size": 434986234
20
+ }
b70/tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d777ef5bdc1aa36227abdfb77c3e49e7b9c892d16e1b6bda41c393504828be4
3
+ size 32170510
b70/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_token": "<|audio|>",
3
+ "backend": "tokenizers",
4
+ "boa_token": "<|audio>",
5
+ "boi_token": "<|image>",
6
+ "bos_token": "<bos>",
7
+ "eoa_token": "<audio|>",
8
+ "eoc_token": "<channel|>",
9
+ "eoi_token": "<image|>",
10
+ "eos_token": "<eos>",
11
+ "eot_token": "<turn|>",
12
+ "escape_token": "<|\"|>",
13
+ "etc_token": "<tool_call|>",
14
+ "etd_token": "<tool|>",
15
+ "etr_token": "<tool_response|>",
16
+ "extra_special_tokens": [
17
+ "<|video|>"
18
+ ],
19
+ "image_token": "<|image|>",
20
+ "is_local": true,
21
+ "local_files_only": false,
22
+ "mask_token": "<mask>",
23
+ "model_max_length": 1000000000000000019884624838656,
24
+ "model_specific_special_tokens": {
25
+ "audio_token": "<|audio|>",
26
+ "boa_token": "<|audio>",
27
+ "boi_token": "<|image>",
28
+ "eoa_token": "<audio|>",
29
+ "eoc_token": "<channel|>",
30
+ "eoi_token": "<image|>",
31
+ "eot_token": "<turn|>",
32
+ "escape_token": "<|\"|>",
33
+ "etc_token": "<tool_call|>",
34
+ "etd_token": "<tool|>",
35
+ "etr_token": "<tool_response|>",
36
+ "image_token": "<|image|>",
37
+ "soc_token": "<|channel>",
38
+ "sot_token": "<|turn>",
39
+ "stc_token": "<|tool_call>",
40
+ "std_token": "<|tool>",
41
+ "str_token": "<|tool_response>",
42
+ "think_token": "<|think|>",
43
+ "video_token": "<|video|>"
44
+ },
45
+ "pad_token": "<pad>",
46
+ "padding_side": "right",
47
+ "processor_class": "EmbeddingGemma2Processor",
48
+ "soc_token": "<|channel>",
49
+ "sot_token": "<|turn>",
50
+ "stc_token": "<|tool_call>",
51
+ "std_token": "<|tool>",
52
+ "str_token": "<|tool_response>",
53
+ "think_token": "<|think|>",
54
+ "tokenizer_class": "GemmaTokenizer",
55
+ "unk_token": "<unk>",
56
+ "video_token": "<|video|>"
57
+ }