Upload folder using huggingface_hub
Browse files- .gitattributes +2 -0
- README.md +56 -0
- model/embeddinggemma-300m_float32_static.aimodel/main.hash +1 -0
- model/embeddinggemma-300m_float32_static.aimodel/main.mlirb +3 -0
- model/embeddinggemma-300m_float32_static.aimodel/metadata.json +7 -0
- model/reference.json +47 -0
- model/tokenizer/tokenizer.json +3 -0
- model/tokenizer/tokenizer_config.json +25 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ 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/embeddinggemma-300m_float32_static.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
model/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
tags:
|
| 4 |
+
- coreai
|
| 5 |
+
- sentence-similarity
|
| 6 |
+
- feature-extraction
|
| 7 |
+
- apple-silicon
|
| 8 |
+
- on-device
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# EmbeddingGemma 300m — Core AI export
|
| 12 |
+
|
| 13 |
+
[google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m) as a
|
| 14 |
+
single static Core AI graph: the full sentence-transformers pipeline (transformer →
|
| 15 |
+
mean pooling → dense projection → L2 normalize) runs in-graph, so one call returns a
|
| 16 |
+
normalized 768-d embedding. On-device semantic search / RAG for macOS 27 / iOS 27 beta.
|
| 17 |
+
|
| 18 |
+
Runs out of the box with [CoreAIKit](https://github.com/john-rocky/coreai-kit)'s
|
| 19 |
+
`TextEmbedder`:
|
| 20 |
+
|
| 21 |
+
```swift
|
| 22 |
+
let embedder = try await TextEmbedder() // downloads this repo
|
| 23 |
+
let doc = try await embedder.embed(document: "Tokyo is the capital of Japan.")
|
| 24 |
+
let query = try await embedder.embed(query: "what is the capital of Japan")
|
| 25 |
+
let score = TextEmbedder.cosineSimilarity(doc, query)
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
Retrieval prompt prefixes (`task: search result | query: ` / `title: none | text: `)
|
| 29 |
+
are applied automatically by `TextEmbedder`.
|
| 30 |
+
|
| 31 |
+
## Bundle layout
|
| 32 |
+
|
| 33 |
+
```
|
| 34 |
+
model/
|
| 35 |
+
├── embeddinggemma-300m_float32_static.aimodel
|
| 36 |
+
├── tokenizer/ (HF tokenizer files)
|
| 37 |
+
└── reference.json (torch reference cosines used by the parity test)
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Graph contract
|
| 41 |
+
|
| 42 |
+
| | name | shape | dtype |
|
| 43 |
+
|---|---|---|---|
|
| 44 |
+
| input | `input_ids` | [1, 256] | int32 (pad id 0, mask 0 over padding) |
|
| 45 |
+
| input | `attention_mask` | [1, 256] | int32 |
|
| 46 |
+
| output | `embedding` | [1, 768] | fp32, L2-normalized |
|
| 47 |
+
|
| 48 |
+
Precision: fp32. Cross-runtime parity vs the torch SentenceTransformer pipeline is
|
| 49 |
+
exact to 6 decimal places (see reference.json). fp16 variants (full cast AND
|
| 50 |
+
mixed-precision autocast) produce NaN embeddings on-device — Gemma3 activations
|
| 51 |
+
overflow half precision — so fp32 is shipped; a smaller int8 variant is future work.
|
| 52 |
+
|
| 53 |
+
## License
|
| 54 |
+
|
| 55 |
+
Gemma Terms of Use (see the upstream model card). Conversion script: this repo's
|
| 56 |
+
sibling, based on apple/coreai-models' recipe patterns (BSD-3-Clause).
|
model/embeddinggemma-300m_float32_static.aimodel/main.hash
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
��,��[V��)j'ՙv�Yˌ�o���v%./
|
model/embeddinggemma-300m_float32_static.aimodel/main.mlirb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9af02ca8fc5b1a56bbf1290b6a020327d59976b059cb8cfd6f9cb4e176252e2f
|
| 3 |
+
size 1243973215
|
model/embeddinggemma-300m_float32_static.aimodel/metadata.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assetVersion" : "2.0",
|
| 3 |
+
"license" : "Gemma",
|
| 4 |
+
"description" : "EmbeddingGemma-300m text embedding model (mean pooling + dense projection, L2-normalized 768-d). Source: https:\/\/huggingface.co\/google\/embeddinggemma-300m",
|
| 5 |
+
"creationDate" : "20260612T003758Z",
|
| 6 |
+
"author" : "Google DeepMind"
|
| 7 |
+
}
|
model/reference.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "google/embeddinggemma-300m",
|
| 3 |
+
"seq_len": 256,
|
| 4 |
+
"dtype": "float32",
|
| 5 |
+
"prompts": {
|
| 6 |
+
"query": "task: search result | query: ",
|
| 7 |
+
"document": "title: none | text: ",
|
| 8 |
+
"BitextMining": "task: search result | query: ",
|
| 9 |
+
"Clustering": "task: clustering | query: ",
|
| 10 |
+
"Classification": "task: classification | query: ",
|
| 11 |
+
"InstructionRetrieval": "task: code retrieval | query: ",
|
| 12 |
+
"MultilabelClassification": "task: classification | query: ",
|
| 13 |
+
"PairClassification": "task: sentence similarity | query: ",
|
| 14 |
+
"Reranking": "task: search result | query: ",
|
| 15 |
+
"Retrieval": "task: search result | query: ",
|
| 16 |
+
"Retrieval-query": "task: search result | query: ",
|
| 17 |
+
"Retrieval-document": "title: none | text: ",
|
| 18 |
+
"STS": "task: sentence similarity | query: ",
|
| 19 |
+
"Summarization": "task: summarization | query: "
|
| 20 |
+
},
|
| 21 |
+
"texts": {
|
| 22 |
+
"query_bike": {
|
| 23 |
+
"kind": "query",
|
| 24 |
+
"text": "red bicycle parked at the beach"
|
| 25 |
+
},
|
| 26 |
+
"query_capital": {
|
| 27 |
+
"kind": "query",
|
| 28 |
+
"text": "what is the capital of Japan"
|
| 29 |
+
},
|
| 30 |
+
"doc_bike": {
|
| 31 |
+
"kind": "document",
|
| 32 |
+
"text": "A crimson bike leaning against a palm tree by the sea."
|
| 33 |
+
},
|
| 34 |
+
"doc_tokyo": {
|
| 35 |
+
"kind": "document",
|
| 36 |
+
"text": "Tokyo is the capital and largest city of Japan."
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
"cosines": {
|
| 40 |
+
"query_bike|query_capital": 0.14591985940933228,
|
| 41 |
+
"doc_bike|query_bike": 0.6273255348205566,
|
| 42 |
+
"doc_bike|query_capital": 0.038044270128011703,
|
| 43 |
+
"doc_bike|doc_tokyo": 0.2074926644563675,
|
| 44 |
+
"doc_tokyo|query_bike": 0.08935076743364334,
|
| 45 |
+
"doc_tokyo|query_capital": 0.5779669284820557
|
| 46 |
+
}
|
| 47 |
+
}
|
model/tokenizer/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bcb89366c4787d27671d021cdc006defcd1cb53b02b04213ae8dd47c009c7f71
|
| 3 |
+
size 33385272
|
model/tokenizer/tokenizer_config.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"boi_token": "<start_of_image>",
|
| 4 |
+
"bos_token": "<bos>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eoi_token": "<end_of_image>",
|
| 7 |
+
"eos_token": "<eos>",
|
| 8 |
+
"image_token": "<image_soft_token>",
|
| 9 |
+
"is_local": false,
|
| 10 |
+
"local_files_only": false,
|
| 11 |
+
"mask_token": "<mask>",
|
| 12 |
+
"model_max_length": 2048,
|
| 13 |
+
"model_specific_special_tokens": {
|
| 14 |
+
"boi_token": "<start_of_image>",
|
| 15 |
+
"eoi_token": "<end_of_image>",
|
| 16 |
+
"image_token": "<image_soft_token>"
|
| 17 |
+
},
|
| 18 |
+
"pad_token": "<pad>",
|
| 19 |
+
"padding_side": "right",
|
| 20 |
+
"sp_model_kwargs": null,
|
| 21 |
+
"spaces_between_special_tokens": false,
|
| 22 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 23 |
+
"unk_token": "<unk>",
|
| 24 |
+
"use_default_system_prompt": false
|
| 25 |
+
}
|