Feature Extraction
MLX
Safetensors
multilingual
embedding_gemma2
mlx-vlm
embedding
sentence-similarity
multimodal
image-feature-extraction
audio-feature-extraction
video-feature-extraction
8-bit precision
Instructions to use nativ-community/embeddinggemma-2-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use nativ-community/embeddinggemma-2-8bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download nativ-community/embeddinggemma-2-8bit --local-dir embeddinggemma-2-8bit
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Add 8bit MLX conversion of Google EmbeddingGemma 2
Browse files- .gitattributes +1 -0
- 1_Pooling/config.json +5 -0
- 2_Normalize/config.json +4 -0
- README.md +94 -0
- chat_template.jinja +1 -0
- config.json +187 -0
- config_sentence_transformers.json +38 -0
- model.safetensors +3 -0
- model.safetensors.index.json +0 -0
- modules.json +20 -0
- preprocessor_config.json +21 -0
- processor_config.json +78 -0
- sentence_bert_config.json +27 -0
- tokenizer.json +3 -0
- tokenizer_config.json +57 -0
- validation.json +77 -0
.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 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"embedding_dimension": 768,
|
| 3 |
+
"pooling_mode": "mean",
|
| 4 |
+
"include_prompt": true
|
| 5 |
+
}
|
2_Normalize/config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"module_input_name": "sentence_embedding",
|
| 3 |
+
"module_output_name": "sentence_embedding"
|
| 4 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: google/embeddinggemma-2
|
| 3 |
+
language:
|
| 4 |
+
- multilingual
|
| 5 |
+
library_name: mlx
|
| 6 |
+
license: apache-2.0
|
| 7 |
+
pipeline_tag: feature-extraction
|
| 8 |
+
tags:
|
| 9 |
+
- mlx
|
| 10 |
+
- mlx-vlm
|
| 11 |
+
- embedding
|
| 12 |
+
- feature-extraction
|
| 13 |
+
- sentence-similarity
|
| 14 |
+
- multimodal
|
| 15 |
+
- image-feature-extraction
|
| 16 |
+
- audio-feature-extraction
|
| 17 |
+
- video-feature-extraction
|
| 18 |
+
---
|
| 19 |
+
# nativ-community/embeddinggemma-2-8bit
|
| 20 |
+
|
| 21 |
+
MLX conversion of [Google EmbeddingGemma 2](https://huggingface.co/google/embeddinggemma-2) in **8-bit affine** format, retaining text, image, audio, and video encoders. The model produces normalized 768-dimensional embeddings. See the [original model card](https://huggingface.co/google/embeddinggemma-2) for intended use, training information, evaluation, and limitations.
|
| 22 |
+
|
| 23 |
+
Quantization mode: `affine`, 8 bits, group size 64. The standard MLX-VLM policy quantizes the text encoder and audio projection. The vision and audio towers and vision projection remain BF16.
|
| 24 |
+
|
| 25 |
+
Weight storage: 1.234 GB (decimal). Source revision: [`914f7f89142e33e77833254d9c9b90c3cef7303b`](https://huggingface.co/google/embeddinggemma-2/tree/914f7f89142e33e77833254d9c9b90c3cef7303b). Converted with [MLX-VLM revision `3d87e884`](https://github.com/Blaizzy/mlx-vlm/tree/3d87e88402f307efbf68e568971aa887ee7d9ed0), from branch `pc/embeddinggemma-2`, and MLX 0.32.3.
|
| 26 |
+
|
| 27 |
+
## Text embeddings
|
| 28 |
+
|
| 29 |
+
Install the implementation revision that includes EmbeddingGemma 2 support:
|
| 30 |
+
|
| 31 |
+
```sh
|
| 32 |
+
pip install "git+https://github.com/Blaizzy/mlx-vlm.git@3d87e88402f307efbf68e568971aa887ee7d9ed0"
|
| 33 |
+
pip install -U "mlx>=0.32.3" "transformers>=5.18.0"
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
import mlx.core as mx
|
| 38 |
+
from transformers import AutoTokenizer
|
| 39 |
+
from mlx_vlm.embedding_loader import load_embedding_model
|
| 40 |
+
from mlx_vlm.utils import get_model_path
|
| 41 |
+
|
| 42 |
+
path = get_model_path("nativ-community/embeddinggemma-2-8bit")
|
| 43 |
+
model = load_embedding_model(path)
|
| 44 |
+
tokenizer = AutoTokenizer.from_pretrained(path)
|
| 45 |
+
inputs = tokenizer([
|
| 46 |
+
"task: search result | query: Which planet is known as the Red Planet?",
|
| 47 |
+
"title: none | text: Mars is known as the Red Planet.",
|
| 48 |
+
"title: none | text: Venus is often called Earth's twin.",
|
| 49 |
+
], padding=True, return_tensors="np")
|
| 50 |
+
embeddings = model(**{key: mx.array(value) for key, value in inputs.items()}).text_embeds
|
| 51 |
+
print(embeddings[:1] @ embeddings[1:].T)
|
| 52 |
+
|
| 53 |
+
# Optional Matryoshka truncation: use 128, 256, 512, or 768 dimensions.
|
| 54 |
+
embeddings = embeddings[:, :256]
|
| 55 |
+
embeddings /= mx.linalg.norm(embeddings, axis=-1, keepdims=True)
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Apply the appropriate task prefixes from `config_sentence_transformers.json`. Queries and documents must use the same embedding dimension. Keep non-quantized weights and activations in BF16; do not cast this model to float16.
|
| 59 |
+
|
| 60 |
+
## Multimodal preprocessing
|
| 61 |
+
|
| 62 |
+
All modality weights and processor configuration files are included. Image, audio, and video preprocessing requires a Transformers build that exposes `EmbeddingGemma2Processor`. Validation used the model's supplied upstream Transformers 5.18.0.dev0 build; stock PyPI Transformers 5.18.0 does not yet expose this processor. The text-only example above uses `AutoTokenizer` and does not require that processor. With a compatible processor build:
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
from mlx_vlm import load
|
| 66 |
+
|
| 67 |
+
model, processor = load("nativ-community/embeddinggemma-2-8bit")
|
| 68 |
+
inputs = processor(images=[image], return_tensors="np") # image is a PIL image
|
| 69 |
+
embedding = model(**{key: mx.array(value) for key, value in inputs.items()}).text_embeds
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## Conversion checks
|
| 73 |
+
|
| 74 |
+
All checked outputs were finite, unit-normalized, and had 768 dimensions. The text retrieval smoke test ranked the Mars passage above Venus. Checks cover six multilingual text inputs and synthetic image, audio, two-frame video, and text+image inputs; they are numerical smoke checks, not MTEB or a retrieval-quality benchmark. Cosine and absolute errors compare against the original checkpoint running in PyTorch FP32.
|
| 75 |
+
|
| 76 |
+
| Input | Minimum cosine vs FP32 | Maximum absolute error |
|
| 77 |
+
| --- | ---: | ---: |
|
| 78 |
+
| audio | 0.999804 | 0.002476 |
|
| 79 |
+
| image | 0.999890 | 0.001937 |
|
| 80 |
+
| text | 0.999814 | 0.002299 |
|
| 81 |
+
| text_image | 0.999823 | 0.002105 |
|
| 82 |
+
| video | 0.999836 | 0.002130 |
|
| 83 |
+
|
| 84 |
+
The full measurements, including truncated-vector comparisons, are in `validation.json`.
|
| 85 |
+
|
| 86 |
+
## Reproduce conversion
|
| 87 |
+
|
| 88 |
+
Using the implementation and compatible processor environment described above:
|
| 89 |
+
|
| 90 |
+
```sh
|
| 91 |
+
python -m mlx_vlm convert --hf-path google/embeddinggemma-2 --revision 914f7f89142e33e77833254d9c9b90c3cef7303b --mlx-path embeddinggemma-2-8bit --dtype bfloat16 -q --q-mode affine --q-bits 8 --q-group-size 64
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
The source model declares Apache-2.0 licensing. This conversion preserves that license and attribution to Google.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{%- for msg in messages if msg.get('role') == 'system' -%}{%- if msg.get('content') is string -%}{{ msg['content'] }}{%- else -%}{%- for item in msg['content'] if item.get('type') == 'text' -%}{{ item['text'] }}{%- endfor -%}{%- endif -%}{%- endfor -%}{%- for msg in messages if msg.get('role') != 'system' -%}{%- if msg.get('content') is string -%}{{ msg['content'] }}{%- else -%}{%- set existing_text = msg['content'] | selectattr('type', 'equalto', 'text') | map(attribute='text') | join -%}{%- set has_manual_placeholders = ('<|image|>' in existing_text) or ('<|video|>' in existing_text) or ('<|audio|>' in existing_text) -%}{%- for item in msg['content'] -%}{%- if item.get('type') == 'text' -%}{{ item['text'] }}{%- elif not has_manual_placeholders and item.get('type') == 'image' -%}<|image|>{%- elif not has_manual_placeholders and item.get('type') == 'video' -%}<|video|>{%- elif not has_manual_placeholders and item.get('type') == 'audio' -%}<|audio|>{%- endif -%}{%- endfor -%}{%- endif -%}{%- endfor -%}
|
config.json
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"EmbeddingGemma2Model"
|
| 4 |
+
],
|
| 5 |
+
"audio_config": {
|
| 6 |
+
"_name_or_path": "",
|
| 7 |
+
"architectures": null,
|
| 8 |
+
"attention_chunk_size": 12,
|
| 9 |
+
"attention_context_left": 13,
|
| 10 |
+
"attention_context_right": 0,
|
| 11 |
+
"attention_invalid_logits_value": -1000000000.0,
|
| 12 |
+
"attention_logit_cap": 50.0,
|
| 13 |
+
"chunk_size_feed_forward": 0,
|
| 14 |
+
"conv_kernel_size": 5,
|
| 15 |
+
"dtype": "bfloat16",
|
| 16 |
+
"gradient_clipping": 10000000000.0,
|
| 17 |
+
"hidden_act": "silu",
|
| 18 |
+
"hidden_size": 1024,
|
| 19 |
+
"id2label": {
|
| 20 |
+
"0": "LABEL_0",
|
| 21 |
+
"1": "LABEL_1"
|
| 22 |
+
},
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"is_encoder_decoder": false,
|
| 25 |
+
"label2id": {
|
| 26 |
+
"LABEL_0": 0,
|
| 27 |
+
"LABEL_1": 1
|
| 28 |
+
},
|
| 29 |
+
"model_type": "gemma4_audio",
|
| 30 |
+
"num_attention_heads": 8,
|
| 31 |
+
"num_hidden_layers": 12,
|
| 32 |
+
"output_attentions": false,
|
| 33 |
+
"output_hidden_states": false,
|
| 34 |
+
"output_proj_dims": 1536,
|
| 35 |
+
"problem_type": null,
|
| 36 |
+
"residual_weight": 0.5,
|
| 37 |
+
"return_dict": true,
|
| 38 |
+
"rms_norm_eps": 1e-06,
|
| 39 |
+
"subsampling_conv_channels": [
|
| 40 |
+
128,
|
| 41 |
+
32
|
| 42 |
+
],
|
| 43 |
+
"use_clipped_linears": true
|
| 44 |
+
},
|
| 45 |
+
"audio_token_id": 258881,
|
| 46 |
+
"boa_token_id": 256000,
|
| 47 |
+
"boi_token_id": 255999,
|
| 48 |
+
"dtype": "bfloat16",
|
| 49 |
+
"eoa_token_index": 258883,
|
| 50 |
+
"eoi_token_id": 258882,
|
| 51 |
+
"image_token_id": 258880,
|
| 52 |
+
"initializer_range": 0.02,
|
| 53 |
+
"model_type": "embedding_gemma2",
|
| 54 |
+
"quantization": {
|
| 55 |
+
"group_size": 64,
|
| 56 |
+
"bits": 8,
|
| 57 |
+
"mode": "affine"
|
| 58 |
+
},
|
| 59 |
+
"quantization_config": {
|
| 60 |
+
"group_size": 64,
|
| 61 |
+
"bits": 8,
|
| 62 |
+
"mode": "affine"
|
| 63 |
+
},
|
| 64 |
+
"text_config": {
|
| 65 |
+
"attention_bias": false,
|
| 66 |
+
"attention_dropout": 0.0,
|
| 67 |
+
"bos_token_id": 2,
|
| 68 |
+
"dtype": "bfloat16",
|
| 69 |
+
"embedding_dim": 768,
|
| 70 |
+
"eos_token_id": 1,
|
| 71 |
+
"head_dim": 256,
|
| 72 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 73 |
+
"hidden_size": 512,
|
| 74 |
+
"hidden_size_per_layer_input": 512,
|
| 75 |
+
"initializer_range": 0.02,
|
| 76 |
+
"intermediate_size": 2048,
|
| 77 |
+
"layer_types": [
|
| 78 |
+
"sliding_attention",
|
| 79 |
+
"sliding_attention",
|
| 80 |
+
"sliding_attention",
|
| 81 |
+
"sliding_attention",
|
| 82 |
+
"sliding_attention",
|
| 83 |
+
"full_attention",
|
| 84 |
+
"sliding_attention",
|
| 85 |
+
"sliding_attention",
|
| 86 |
+
"sliding_attention",
|
| 87 |
+
"sliding_attention",
|
| 88 |
+
"sliding_attention",
|
| 89 |
+
"full_attention",
|
| 90 |
+
"sliding_attention",
|
| 91 |
+
"sliding_attention",
|
| 92 |
+
"sliding_attention",
|
| 93 |
+
"sliding_attention",
|
| 94 |
+
"sliding_attention",
|
| 95 |
+
"full_attention",
|
| 96 |
+
"sliding_attention",
|
| 97 |
+
"sliding_attention",
|
| 98 |
+
"sliding_attention",
|
| 99 |
+
"sliding_attention",
|
| 100 |
+
"sliding_attention",
|
| 101 |
+
"full_attention"
|
| 102 |
+
],
|
| 103 |
+
"max_position_embeddings": 262144,
|
| 104 |
+
"model_type": "embedding_gemma2_text",
|
| 105 |
+
"num_attention_heads": 4,
|
| 106 |
+
"num_hidden_layers": 24,
|
| 107 |
+
"num_key_value_heads": 2,
|
| 108 |
+
"pad_token_id": 0,
|
| 109 |
+
"per_layer_config": {
|
| 110 |
+
"05": {
|
| 111 |
+
"head_dim": 512,
|
| 112 |
+
"num_key_value_heads": 1
|
| 113 |
+
},
|
| 114 |
+
"11": {
|
| 115 |
+
"head_dim": 512,
|
| 116 |
+
"num_key_value_heads": 1
|
| 117 |
+
},
|
| 118 |
+
"17": {
|
| 119 |
+
"head_dim": 512,
|
| 120 |
+
"num_key_value_heads": 1
|
| 121 |
+
},
|
| 122 |
+
"23": {
|
| 123 |
+
"head_dim": 512,
|
| 124 |
+
"num_key_value_heads": 1
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
"rms_norm_eps": 1e-06,
|
| 128 |
+
"rope_parameters": {
|
| 129 |
+
"full_attention": {
|
| 130 |
+
"rope_theta": 1000000.0,
|
| 131 |
+
"rope_type": "default"
|
| 132 |
+
},
|
| 133 |
+
"sliding_attention": {
|
| 134 |
+
"rope_theta": 10000.0,
|
| 135 |
+
"rope_type": "default"
|
| 136 |
+
}
|
| 137 |
+
},
|
| 138 |
+
"sliding_window": 512,
|
| 139 |
+
"vocab_size": 262144
|
| 140 |
+
},
|
| 141 |
+
"transformers_version": "5.18.0.dev0",
|
| 142 |
+
"video_token_id": 258884,
|
| 143 |
+
"vision_config": {
|
| 144 |
+
"_name_or_path": "",
|
| 145 |
+
"architectures": null,
|
| 146 |
+
"attention_bias": false,
|
| 147 |
+
"attention_dropout": 0.0,
|
| 148 |
+
"chunk_size_feed_forward": 0,
|
| 149 |
+
"default_output_length": 280,
|
| 150 |
+
"dtype": "bfloat16",
|
| 151 |
+
"global_head_dim": 64,
|
| 152 |
+
"head_dim": 64,
|
| 153 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 154 |
+
"hidden_size": 768,
|
| 155 |
+
"id2label": {
|
| 156 |
+
"0": "LABEL_0",
|
| 157 |
+
"1": "LABEL_1"
|
| 158 |
+
},
|
| 159 |
+
"initializer_range": 0.02,
|
| 160 |
+
"intermediate_size": 3072,
|
| 161 |
+
"is_encoder_decoder": false,
|
| 162 |
+
"label2id": {
|
| 163 |
+
"LABEL_0": 0,
|
| 164 |
+
"LABEL_1": 1
|
| 165 |
+
},
|
| 166 |
+
"max_position_embeddings": 131072,
|
| 167 |
+
"model_type": "gemma4_vision",
|
| 168 |
+
"num_attention_heads": 12,
|
| 169 |
+
"num_hidden_layers": 16,
|
| 170 |
+
"num_key_value_heads": 12,
|
| 171 |
+
"output_attentions": false,
|
| 172 |
+
"output_hidden_states": false,
|
| 173 |
+
"patch_size": 16,
|
| 174 |
+
"pooling_kernel_size": 3,
|
| 175 |
+
"position_embedding_size": 10240,
|
| 176 |
+
"problem_type": null,
|
| 177 |
+
"return_dict": true,
|
| 178 |
+
"rms_norm_eps": 1e-06,
|
| 179 |
+
"rope_parameters": {
|
| 180 |
+
"rope_theta": 100.0,
|
| 181 |
+
"rope_type": "axial"
|
| 182 |
+
},
|
| 183 |
+
"standardize": false,
|
| 184 |
+
"use_clipped_linears": false
|
| 185 |
+
},
|
| 186 |
+
"vision_soft_tokens_per_image": 280
|
| 187 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"pytorch": "2.14.0+cu130",
|
| 4 |
+
"sentence_transformers": "6.1.0",
|
| 5 |
+
"transformers": "5.18.0.dev0"
|
| 6 |
+
},
|
| 7 |
+
"default_prompt_name": null,
|
| 8 |
+
"model_type": "SentenceTransformer",
|
| 9 |
+
"prompts": {
|
| 10 |
+
"BitextMining": "task: search result | query: ",
|
| 11 |
+
"Classification": "task: classification | query: ",
|
| 12 |
+
"Clustering": "task: clustering | query: ",
|
| 13 |
+
"CodeRetrieval": "task: code retrieval | query: ",
|
| 14 |
+
"Document": "title: none | text: ",
|
| 15 |
+
"FactChecking": "task: fact checking | query: ",
|
| 16 |
+
"InstructionRetrieval": "task: code retrieval | query: ",
|
| 17 |
+
"MultilabelClassification": "task: classification | query: ",
|
| 18 |
+
"PairClassification": "task: sentence similarity | query: ",
|
| 19 |
+
"QuestionAnswering": "task: question answering | query: ",
|
| 20 |
+
"Reranking": "task: search result | query: ",
|
| 21 |
+
"Retrieval": "task: search result | query: ",
|
| 22 |
+
"Retrieval-document": "title: none | text: ",
|
| 23 |
+
"Retrieval-query": "task: search result | query: ",
|
| 24 |
+
"STS": "task: sentence similarity | query: ",
|
| 25 |
+
"SearchQuery": "task: search result | query: ",
|
| 26 |
+
"SentenceSimilarity": "task: sentence similarity | query: ",
|
| 27 |
+
"Summarization": "task: sentence similarity | query: ",
|
| 28 |
+
"document": "title: none | text: ",
|
| 29 |
+
"query": "task: search result | query: "
|
| 30 |
+
},
|
| 31 |
+
"requirements": {
|
| 32 |
+
"sentence-transformers": {
|
| 33 |
+
"reason": "Older versions ignore the order of multimodal dict inputs and cannot put several images or texts into a single embedding.",
|
| 34 |
+
"specifier": ">=6.1.0"
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
"similarity_fn_name": "cosine"
|
| 38 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b7e97f9687ad422ab3625a1cdf6002892187d7dd04d01b2a09253fa1e5d4cfd
|
| 3 |
+
size 1234238431
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
modules.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.base.modules.transformer.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Pooling",
|
| 12 |
+
"type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.base.modules.normalize.Normalize"
|
| 19 |
+
}
|
| 20 |
+
]
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"dither": 0.0,
|
| 3 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 4 |
+
"feature_size": 128,
|
| 5 |
+
"fft_length": 512,
|
| 6 |
+
"fft_overdrive": false,
|
| 7 |
+
"frame_length": 320,
|
| 8 |
+
"hop_length": 160,
|
| 9 |
+
"input_scale_factor": 1.0,
|
| 10 |
+
"max_frequency": 8000.0,
|
| 11 |
+
"mel_floor": 0.001,
|
| 12 |
+
"min_frequency": 0.0,
|
| 13 |
+
"padding_side": "right",
|
| 14 |
+
"padding_value": 0.0,
|
| 15 |
+
"per_bin_mean": null,
|
| 16 |
+
"per_bin_stddev": null,
|
| 17 |
+
"preemphasis": 0.0,
|
| 18 |
+
"preemphasis_htk_flavor": true,
|
| 19 |
+
"return_attention_mask": true,
|
| 20 |
+
"sampling_rate": 16000
|
| 21 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_ms_per_token": 40,
|
| 3 |
+
"audio_seq_length": 280,
|
| 4 |
+
"feature_extractor": {
|
| 5 |
+
"dither": 0.0,
|
| 6 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 7 |
+
"feature_size": 128,
|
| 8 |
+
"fft_length": 512,
|
| 9 |
+
"fft_overdrive": false,
|
| 10 |
+
"frame_length": 320,
|
| 11 |
+
"hop_length": 160,
|
| 12 |
+
"input_scale_factor": 1.0,
|
| 13 |
+
"max_frequency": 8000.0,
|
| 14 |
+
"mel_floor": 0.001,
|
| 15 |
+
"min_frequency": 0.0,
|
| 16 |
+
"padding_side": "right",
|
| 17 |
+
"padding_value": 0.0,
|
| 18 |
+
"per_bin_mean": null,
|
| 19 |
+
"per_bin_stddev": null,
|
| 20 |
+
"preemphasis": 0.0,
|
| 21 |
+
"preemphasis_htk_flavor": true,
|
| 22 |
+
"return_attention_mask": true,
|
| 23 |
+
"sampling_rate": 16000
|
| 24 |
+
},
|
| 25 |
+
"image_processor": {
|
| 26 |
+
"do_convert_rgb": true,
|
| 27 |
+
"do_normalize": false,
|
| 28 |
+
"do_rescale": true,
|
| 29 |
+
"do_resize": true,
|
| 30 |
+
"image_mean": [
|
| 31 |
+
0.0,
|
| 32 |
+
0.0,
|
| 33 |
+
0.0
|
| 34 |
+
],
|
| 35 |
+
"image_processor_type": "Gemma4ImageProcessor",
|
| 36 |
+
"image_seq_length": 280,
|
| 37 |
+
"image_std": [
|
| 38 |
+
1.0,
|
| 39 |
+
1.0,
|
| 40 |
+
1.0
|
| 41 |
+
],
|
| 42 |
+
"max_soft_tokens": 280,
|
| 43 |
+
"patch_size": 16,
|
| 44 |
+
"pooling_kernel_size": 3,
|
| 45 |
+
"resample": 3,
|
| 46 |
+
"rescale_factor": 0.00392156862745098
|
| 47 |
+
},
|
| 48 |
+
"image_seq_length": 280,
|
| 49 |
+
"processor_class": "EmbeddingGemma2Processor",
|
| 50 |
+
"video_processor": {
|
| 51 |
+
"add_timestamps": false,
|
| 52 |
+
"do_convert_rgb": true,
|
| 53 |
+
"do_normalize": false,
|
| 54 |
+
"do_rescale": true,
|
| 55 |
+
"do_resize": true,
|
| 56 |
+
"do_sample_frames": true,
|
| 57 |
+
"fps": 1,
|
| 58 |
+
"image_mean": [
|
| 59 |
+
0.0,
|
| 60 |
+
0.0,
|
| 61 |
+
0.0
|
| 62 |
+
],
|
| 63 |
+
"image_std": [
|
| 64 |
+
1.0,
|
| 65 |
+
1.0,
|
| 66 |
+
1.0
|
| 67 |
+
],
|
| 68 |
+
"max_frames": 32,
|
| 69 |
+
"max_soft_tokens": 140,
|
| 70 |
+
"overflow_strategy": "uniform",
|
| 71 |
+
"patch_size": 16,
|
| 72 |
+
"pooling_kernel_size": 3,
|
| 73 |
+
"resample": 3,
|
| 74 |
+
"rescale_factor": 0.00392156862745098,
|
| 75 |
+
"return_metadata": false,
|
| 76 |
+
"video_processor_type": "EmbeddingGemma2VideoProcessor"
|
| 77 |
+
}
|
| 78 |
+
}
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"transformer_task": "feature-extraction",
|
| 3 |
+
"modality_config": {
|
| 4 |
+
"text": {
|
| 5 |
+
"method": "forward",
|
| 6 |
+
"method_output_name": "last_hidden_state"
|
| 7 |
+
},
|
| 8 |
+
"image": {
|
| 9 |
+
"method": "forward",
|
| 10 |
+
"method_output_name": "last_hidden_state"
|
| 11 |
+
},
|
| 12 |
+
"audio": {
|
| 13 |
+
"method": "forward",
|
| 14 |
+
"method_output_name": "last_hidden_state"
|
| 15 |
+
},
|
| 16 |
+
"video": {
|
| 17 |
+
"method": "forward",
|
| 18 |
+
"method_output_name": "last_hidden_state"
|
| 19 |
+
},
|
| 20 |
+
"message": {
|
| 21 |
+
"method": "forward",
|
| 22 |
+
"method_output_name": "last_hidden_state",
|
| 23 |
+
"format": "structured"
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
"module_output_name": "token_embeddings"
|
| 27 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d777ef5bdc1aa36227abdfb77c3e49e7b9c892d16e1b6bda41c393504828be4
|
| 3 |
+
size 32170510
|
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 |
+
}
|
validation.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_model": "google/embeddinggemma-2",
|
| 3 |
+
"source_revision": "914f7f89142e33e77833254d9c9b90c3cef7303b",
|
| 4 |
+
"mlx_vlm_revision": "3d87e88402f307efbf68e568971aa887ee7d9ed0",
|
| 5 |
+
"variant": "8bit",
|
| 6 |
+
"hardware": "Apple M3 Ultra",
|
| 7 |
+
"mlx_version": "0.32.3",
|
| 8 |
+
"transformers_version": "5.18.0.dev0",
|
| 9 |
+
"validation_scope": "Six multilingual text inputs and synthetic image, audio, two-frame video, and text+image; numerical smoke checks, not a retrieval benchmark.",
|
| 10 |
+
"tensor_count": 1816,
|
| 11 |
+
"tensor_dtypes": [
|
| 12 |
+
"BF16",
|
| 13 |
+
"U32"
|
| 14 |
+
],
|
| 15 |
+
"weight_bytes": 1234238431,
|
| 16 |
+
"cases": {
|
| 17 |
+
"audio": {
|
| 18 |
+
"shape": [
|
| 19 |
+
1,
|
| 20 |
+
768
|
| 21 |
+
],
|
| 22 |
+
"finite": true,
|
| 23 |
+
"minimum_cosine_vs_torch_fp32": 0.9998035070404524,
|
| 24 |
+
"maximum_absolute_error_vs_torch_fp32": 0.002476184321109907,
|
| 25 |
+
"minimum_cosine_vs_source_bf16": 0.9997744741131873,
|
| 26 |
+
"minimum_truncated_cosine_vs_torch_fp32": 0.9998247233031456
|
| 27 |
+
},
|
| 28 |
+
"image": {
|
| 29 |
+
"shape": [
|
| 30 |
+
1,
|
| 31 |
+
768
|
| 32 |
+
],
|
| 33 |
+
"finite": true,
|
| 34 |
+
"minimum_cosine_vs_torch_fp32": 0.9998904477000761,
|
| 35 |
+
"maximum_absolute_error_vs_torch_fp32": 0.0019366481302732774,
|
| 36 |
+
"minimum_cosine_vs_source_bf16": 0.9999318244275229,
|
| 37 |
+
"minimum_truncated_cosine_vs_torch_fp32": 0.9998950619484888
|
| 38 |
+
},
|
| 39 |
+
"text": {
|
| 40 |
+
"shape": [
|
| 41 |
+
6,
|
| 42 |
+
768
|
| 43 |
+
],
|
| 44 |
+
"finite": true,
|
| 45 |
+
"minimum_cosine_vs_torch_fp32": 0.9998142728897385,
|
| 46 |
+
"maximum_absolute_error_vs_torch_fp32": 0.0022990193383245483,
|
| 47 |
+
"minimum_cosine_vs_source_bf16": 0.9997514709446282,
|
| 48 |
+
"minimum_truncated_cosine_vs_torch_fp32": 0.9998170484369469,
|
| 49 |
+
"retrieval_scores_venus_mars": [
|
| 50 |
+
0.678564727306366,
|
| 51 |
+
0.8342599868774414
|
| 52 |
+
]
|
| 53 |
+
},
|
| 54 |
+
"text_image": {
|
| 55 |
+
"shape": [
|
| 56 |
+
1,
|
| 57 |
+
768
|
| 58 |
+
],
|
| 59 |
+
"finite": true,
|
| 60 |
+
"minimum_cosine_vs_torch_fp32": 0.9998230728231623,
|
| 61 |
+
"maximum_absolute_error_vs_torch_fp32": 0.002104893632396264,
|
| 62 |
+
"minimum_cosine_vs_source_bf16": 0.999874734632146,
|
| 63 |
+
"minimum_truncated_cosine_vs_torch_fp32": 0.999830769497079
|
| 64 |
+
},
|
| 65 |
+
"video": {
|
| 66 |
+
"shape": [
|
| 67 |
+
1,
|
| 68 |
+
768
|
| 69 |
+
],
|
| 70 |
+
"finite": true,
|
| 71 |
+
"minimum_cosine_vs_torch_fp32": 0.9998359946491495,
|
| 72 |
+
"maximum_absolute_error_vs_torch_fp32": 0.0021304845535331423,
|
| 73 |
+
"minimum_cosine_vs_source_bf16": 0.9998825464984411,
|
| 74 |
+
"minimum_truncated_cosine_vs_torch_fp32": 0.9998420387979006
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|