|
--- |
|
license: mit |
|
language: |
|
- en |
|
--- |
|
|
|
# bge-micro-v2-quant |
|
|
|
This is the quantized (INT8) ONNX variant of the [bge-micro-v2](https://huggingface.co./TaylorAI/bge-micro-v2) embeddings model created with [DeepSparse Optimum](https://github.com/neuralmagic/optimum-deepsparse) for ONNX export/inference and Neural Magic's [Sparsify](https://github.com/neuralmagic/sparsify) for one-shot quantization. |
|
|
|
```bash |
|
pip install -U deepsparse-nightly[sentence_transformers] |
|
``` |
|
|
|
```python |
|
from deepsparse.sentence_transformers import SentenceTransformer |
|
model = SentenceTransformer('zeroshot/bge-micro-v2-quant', export=False) |
|
|
|
# Our sentences we like to encode |
|
sentences = ['This framework generates embeddings for each input sentence', |
|
'Sentences are passed as a list of string.', |
|
'The quick brown fox jumps over the lazy dog.'] |
|
|
|
# Sentences are encoded by calling model.encode() |
|
embeddings = model.encode(sentences) |
|
|
|
# Print the embeddings |
|
for sentence, embedding in zip(sentences, embeddings): |
|
print("Sentence:", sentence) |
|
print("Embedding:", embedding.shape) |
|
print("") |
|
``` |
|
|
|
For further details regarding DeepSparse & Sentence Transformers integration, refer to the [DeepSparse README](https://github.com/neuralmagic/deepsparse/tree/main/src/deepsparse/sentence_transformers). |
|
|
|
For general questions on these models and sparsification methods, reach out to the engineering team on our [community Slack](https://join.slack.com/t/discuss-neuralmagic/shared_invite/zt-q1a1cnvo-YBoICSIw3L1dmQpjBeDurQ). |
|
|
|
![;)](https://media.giphy.com/media/bYg33GbNbNIVzSrr84/giphy-downsized-large.gif) |