multilingual-e5-small Core ML v1 (int8)
Browse files- README.md +46 -0
- SentenceEncoder.mlpackage.zip +3 -0
- manifest.json +21 -0
- tokenizer.zip +3 -0
README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: intfloat/multilingual-e5-small
|
| 4 |
+
tags:
|
| 5 |
+
- coreml
|
| 6 |
+
- sentence-similarity
|
| 7 |
+
- multilingual
|
| 8 |
+
- macos
|
| 9 |
+
library_name: coreml
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# multilingual-e5-small — Core ML
|
| 13 |
+
|
| 14 |
+
Core ML conversion of [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small)
|
| 15 |
+
(revision `614241f622f53c4eeff9890bdc4f31cfecc418b3`), used by the Lenz macOS video editor to search
|
| 16 |
+
talk transcripts by meaning, on device. This repository only hosts the files the app downloads once.
|
| 17 |
+
|
| 18 |
+
## Files
|
| 19 |
+
|
| 20 |
+
| File | Contents |
|
| 21 |
+
|---|---|
|
| 22 |
+
| `SentenceEncoder.mlpackage.zip` | 12-layer encoder, int8 linear-symmetric weights; inputs `input_ids`, `attention_mask` (int32, batch 1–64 × tokens 1–512); output `hidden_states` (float32, batch × tokens × 384) |
|
| 23 |
+
| `tokenizer.zip` | XLM-RoBERTa tokenizer files (`tokenizer.json`, config) for swift-transformers |
|
| 24 |
+
| `manifest.json` | File names, sha256s, sizes, model dims |
|
| 25 |
+
|
| 26 |
+
## Usage notes
|
| 27 |
+
|
| 28 |
+
- Prefix every text with its role: `passage: ` for indexed sentences, `query: ` for searches.
|
| 29 |
+
Same-prefix use measurably hurts retrieval.
|
| 30 |
+
- Sentence vector = mean of `hidden_states` over tokens where `attention_mask` is 1, then L2-normalised;
|
| 31 |
+
similarity is a dot product.
|
| 32 |
+
- Pad with `<pad>` (id 1) and a zero mask; truncate to 512 tokens keeping the final `</s>`.
|
| 33 |
+
- Flexible shapes run fastest on the CPU compute unit (≈0.9 ms per sentence on an M2 Max).
|
| 34 |
+
- Conversion is parity-gated: pooled vectors match PyTorch at cosine ≥ 0.99 on EN/DE fixtures
|
| 35 |
+
(int8 worst 0.99983). Source: `models/multilingual-e5-small/convert.py` in the Lenz repository.
|
| 36 |
+
|
| 37 |
+
## Versioning
|
| 38 |
+
|
| 39 |
+
Files in this repo are immutable once published. Re-conversions are published as new versions, never
|
| 40 |
+
overwrites.
|
| 41 |
+
|
| 42 |
+
## License
|
| 43 |
+
|
| 44 |
+
MIT, same as the original weights by intfloat (Liang Wang et al., "Multilingual E5 Text Embeddings",
|
| 45 |
+
arXiv:2402.05672). This repository redistributes a converted form of those weights without modification
|
| 46 |
+
to their values beyond int8 weight quantization.
|
SentenceEncoder.mlpackage.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a4ad137ae4ac3604e8b63cbe9422a79a78976ed10b35b63c3576ee6ba27849de
|
| 3 |
+
size 109057682
|
manifest.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "multilingual-e5-small",
|
| 3 |
+
"revision": "614241f622f53c4eeff9890bdc4f31cfecc418b3",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"weights": "int8",
|
| 6 |
+
"dimension": 384,
|
| 7 |
+
"maxTokens": 512,
|
| 8 |
+
"maxBatch": 64,
|
| 9 |
+
"files": {
|
| 10 |
+
"encoder": {
|
| 11 |
+
"name": "SentenceEncoder.mlpackage.zip",
|
| 12 |
+
"sha256": "a4ad137ae4ac3604e8b63cbe9422a79a78976ed10b35b63c3576ee6ba27849de",
|
| 13 |
+
"bytes": 109057682
|
| 14 |
+
},
|
| 15 |
+
"tokenizer": {
|
| 16 |
+
"name": "tokenizer.zip",
|
| 17 |
+
"sha256": "436b8a8443061ba3dae48686b41cde5ac537180a8e2e4ea2fba8887148669ef9",
|
| 18 |
+
"bytes": 4007618
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
tokenizer.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:436b8a8443061ba3dae48686b41cde5ac537180a8e2e4ea2fba8887148669ef9
|
| 3 |
+
size 4007618
|