Views
No views yet
| Property | Value |
|---|---|
| Parameters | 22.7M |
| Embedding dim | 384 |
| Max input tokens | 256 |
| Original model | ~90 MB (FP32) |
| Core ML size | ~43 MB (FP16) |
| Compute units | CPU + Neural Engine |
| Min deployment | iOS 18 / macOS 15 |
all-minilm-l6-v2.mlpackage/ — Core ML model package (portable format). Compile with xcrun coremlcompiler for your target device.all-minilm-l6-v2.mlmodelc/ — Pre-compiled model for Apple Silicon Macs.tokenizer/ — BERT WordPiece tokenizer (tokenizer.json, vocab.txt, config files).1import CoreML
2
3let model = try MLModel(contentsOf: modelURL)
4let prediction = try await model.prediction(input: [
5 "input_ids": inputIds,
6 "attention_mask": attentionMask,
7 "token_type_ids": tokenTypeIds
8])
9let embedding = prediction.featureValue(for: "div_1")!.multiArrayValue!
10// Shape: (1, 384), L2-normalized1import coremltools as ct
2from transformers import AutoTokenizer
3
4model = ct.models.MLModel("all-minilm-l6-v2.mlpackage")
5tokenizer = AutoTokenizer.from_pretrained("tokenizer/")
6
7encoded = tokenizer("Hello world", return_tensors="np",
8 padding="max_length", truncation=True, max_length=256)
9prediction = model.predict({
10 "input_ids": encoded["input_ids"].astype("int32"),
11 "attention_mask": encoded["attention_mask"].astype("int32"),
12 "token_type_ids": encoded["token_type_ids"].astype("int32"),
13})
14embedding = prediction["div_1"] # (1, 384), L2-normalized| Metric | Value |
|---|---|
| Max element diff vs PyTorch FP32 | ~0.001 |
| Cosine similarity vs original | > 0.99995 |
sentence-transformers/all-MiniLM-L6-v2 (PyTorch)
→ torch.export (dynamo)
→ coremltools 9.0 (FP16, iOS18)
→ all-minilm-l6-v2.mlpackage
→ xcrun coremlcompiler
→ all-minilm-l6-v2.mlmodelc