Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- onnx
|
| 7 |
---
|
| 8 |
+
This is the ONNX variant of the [gte-small](https://huggingface.co/thenlper/gte-small) embeddings model created with the [DeepSparse Optimum](https://github.com/neuralmagic/optimum-deepsparse) integration.
|
| 9 |
+
|
| 10 |
+
To replicate ONNX export, run:
|
| 11 |
+
|
| 12 |
+
```bash
|
| 13 |
+
pip install git+https://github.com/neuralmagic/optimum-deepsparse.git
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
from optimum.deepsparse import DeepSparseModelForFeatureExtraction
|
| 18 |
+
from transformers.onnx.utils import get_preprocessor
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
|
| 21 |
+
model_id = "thenlper/gte-small"
|
| 22 |
+
|
| 23 |
+
# load model and convert to onnx
|
| 24 |
+
model = DeepSparseModelForFeatureExtraction.from_pretrained(model_id, export=True)
|
| 25 |
+
tokenizer = get_preprocessor(model_id)
|
| 26 |
+
|
| 27 |
+
# save onnx checkpoint and tokenizer
|
| 28 |
+
onnx_path = Path("gte-small-dense")
|
| 29 |
+
model.save_pretrained(onnx_path)
|
| 30 |
+
tokenizer.save_pretrained(onnx_path)
|
| 31 |
+
```
|