Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- colbert
|
| 5 |
+
- onnx
|
| 6 |
+
- zero-pytorch
|
| 7 |
+
- modernbert
|
| 8 |
+
- text-embeddings
|
| 9 |
+
pipeline_tag: feature-extraction
|
| 10 |
+
library_name: generic
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# lateon-onnx
|
| 14 |
+
|
| 15 |
+
This repository hosts the optimized, single-file **ONNX representation** of the ModernBERT-backed [lightonai/LateOn](https://huggingface.co/lightonai/LateOn) model.
|
| 16 |
+
|
| 17 |
+
It is designed to run completely PyTorch-free and dependency-free using the [intextus-embed](https://github.com/Intextus/intextus-embed) runtime library.
|
| 18 |
+
|
| 19 |
+
## Model Metadata
|
| 20 |
+
- **Backbone**: ModernBERT-base (140M parameters)
|
| 21 |
+
- **Output Dimensions**: 128-dimensional late-interaction embeddings
|
| 22 |
+
- **ONNX File Size**: 580 MB (fully self-contained, merged weights)
|
| 23 |
+
- **Case Sensitivity**: Case-sensitive (requires `do_lower_case=False`)
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
Install the `intextus-embed` runtime:
|
| 28 |
+
```bash
|
| 29 |
+
pip install intextus-embed
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
Load the model automatically and run inference (set `do_lower_case=False` because LateOn is case-sensitive):
|
| 33 |
+
```python
|
| 34 |
+
from intextus import IntextusEncoder, compute_maxsim
|
| 35 |
+
|
| 36 |
+
# Automatically downloads and caches the model from Hugging Face
|
| 37 |
+
model = IntextusEncoder("lateon", do_lower_case=False)
|
| 38 |
+
|
| 39 |
+
# Encode queries and documents
|
| 40 |
+
query_embeddings = model.encode_queries("What is ultra-low latency?")
|
| 41 |
+
doc_embeddings = model.encode_docs("ONNX runtime bypasses the PyTorch layer completely.")
|
| 42 |
+
|
| 43 |
+
# Compute the MaxSim similarity score via NumPy
|
| 44 |
+
score = compute_maxsim(query_embeddings[0], doc_embeddings[0])
|
| 45 |
+
print(f"Relevance Score (MaxSim): {score:.4f}")
|
| 46 |
+
```
|