File size: 3,110 Bytes
4a99ef1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
  "base_model": "google/embeddinggemma-2",
  "converted_from": "FluidInference/embeddinggemma-2-coreml",
  "format": "coreml-compiled",
  "modality": [
    "text",
    "image"
  ],
  "precision": {
    "weights": "int8 (linear symmetric, per output channel)",
    "activations": "fp16"
  },
  "minimum_os": {
    "macOS": "15.0",
    "iOS": "18.0"
  },
  "hidden_size": 512,
  "embedding_dim": 768,
  "matryoshka_dims": [
    768,
    512,
    256,
    128
  ],
  "embed_scale": 22.627417,
  "text": {
    "model": "text/EmbeddingGemma2Text.mlmodelc",
    "compute_units": "cpuAndNeuralEngine",
    "tokenizer": "text/tokenizer.json",
    "token_table": {
      "file": "text/embeddings.int8",
      "dtype": "int8",
      "shape": [
        262144,
        512
      ],
      "scale_file": "text/embeddings.int8.scale.f16",
      "scale_dtype": "float16",
      "scale_shape": [
        262144
      ],
      "use": "row = int8 values * scale[id] * embed_scale, passed as fp16"
    },
    "functions": {
      "embed_32": {
        "tokens": 32
      },
      "embed_48": {
        "tokens": 48
      },
      "embed_64": {
        "tokens": 64
      },
      "embed_128": {
        "tokens": 128
      },
      "embed_256": {
        "tokens": 256
      },
      "embed_512": {
        "tokens": 512
      },
      "pack_256": {
        "tokens": 256,
        "slots": 8
      }
    }
  },
  "bos_token_id": 2,
  "eos_token_id": 1,
  "pad_token_id": 0,
  "prompts": {
    "document": "title: none | text: ",
    "search_query": "task: search result | query: ",
    "question_answering": "task: question answering | query: ",
    "fact_checking": "task: fact checking | query: ",
    "code_retrieval": "task: code retrieval | query: ",
    "classification": "task: classification | query: ",
    "clustering": "task: clustering | query: ",
    "sentence_similarity": "task: sentence similarity | query: "
  },
  "vision": {
    "model": "vision/EmbeddingGemma2Vision.mlmodelc",
    "compute_units": "cpuAndNeuralEngine for vision_70 and vision_140 (about 7x less energy per image than the GPU in our tests); cpuAndGPU for vision_280 (not tried on the Neural Engine)",
    "functions": {
      "vision_70": {
        "tokens": 70,
        "patches": 630
      },
      "vision_140": {
        "tokens": 140,
        "patches": 1260
      },
      "vision_280": {
        "tokens": 280,
        "patches": 2520
      }
    },
    "patch_size": 16,
    "pooling_kernel": 3,
    "resize": "aspect-preserving, bicubic + antialias, sides multiple of 48 px, at most 9 x tokens patches",
    "pixel_scale": "RGB / 255 (the model applies 2x - 1)",
    "patch_layout": "row-major patches, each [16 rows][16 cols][RGB]",
    "position_table": {
      "file": "vision/position_embeddings.f16",
      "dtype": "float16",
      "shape": [
        2,
        1024,
        768
      ],
      "use": "table[0][x] + table[1][y] per patch, zero for padding"
    },
    "boi_token_id": 255999,
    "eoi_token_id": 258882,
    "text_sequence": "<bos> <|image> [image tokens] <image|> <eos> -> smallest embed_S that fits"
  }
}