Instructions to use Alibaba-NLP/gte-base-en-v1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Alibaba-NLP/gte-base-en-v1.5 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Alibaba-NLP/gte-base-en-v1.5", trust_remote_code=True, dtype="auto") - sentence-transformers
How to use Alibaba-NLP/gte-base-en-v1.5 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Alibaba-NLP/gte-base-en-v1.5", trust_remote_code=True) sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Transformers.js
How to use Alibaba-NLP/gte-base-en-v1.5 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('sentence-similarity', 'Alibaba-NLP/gte-base-en-v1.5'); - Notebooks
- Google Colab
- Kaggle
Add exported onnx model 'model_qint8_arm64.onnx'
Browse filesHello!
*This pull request has been automatically generated from the [`export_dynamic_quantized_onnx_model`](https://sbert.net/docs/package_reference/util.html#sentence_transformers.backend.export_dynamic_quantized_onnx_model) function from the Sentence Transformers library.*
## Config
```python
QuantizationConfig(
is_static=False,
format=<QuantFormat.QOperator: 0>,
mode=<QuantizationMode.IntegerOps: 0>,
activations_dtype=<QuantType.QUInt8: 1>,
activations_symmetric=False,
weights_dtype=<QuantType.QInt8: 0>,
weights_symmetric=True,
per_channel=True,
reduce_range=False,
nodes_to_quantize=[],
nodes_to_exclude=[],
operators_to_quantize=['Conv',
'MatMul',
'Attention',
'LSTM',
'Gather',
'Transpose',
'EmbedLayerNormalization'],
qdq_add_pair_to_weight=False,
qdq_dedicated_pair=False,
qdq_op_type_per_channel_support_to_axis={'MatMul': 1}
)
```
## Tip:
Consider testing this pull request before merging by loading the model from this PR with the `revision` argument:
```python
from sentence_transformers import SentenceTransformer
# TODO: Fill in the PR number
pr_number = 2
model = SentenceTransformer(
"Alibaba-NLP/gte-base-en-v1.5",
revision=f"refs/pr/{pr_number}",
backend="onnx",
model_kwargs={"file_name": "model_qint8_arm64.onnx"},
)
# Verify that everything works as expected
embeddings = model.encode(["The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium."])
print(embeddings.shape)
similarities = model.similarity(embeddings, embeddings)
print(similarities)
```
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:de060e6ac0c2e88cfa450a190024a7211174bac20ddec66fcfb91b2c7ba5ca06
|
| 3 |
+
size 146576223
|