Update README.md
Browse files
README.md
CHANGED
|
@@ -137,7 +137,7 @@ In short:
|
|
| 137 |
3. 🟡 shibing624/text2vec-base-chinese (ov-qint8), int8 quantization with OV incurs a small performance hit on some tasks, and a tiny performance gain on others, when quantizing with [Chinese STSB](https://huggingface.co/datasets/PhilipMay/stsb_multi_mt). Additionally, it results in a [4.78x speedup](https://sbert.net/docs/sentence_transformer/usage/efficiency.html#benchmarks) on CPU.
|
| 138 |
|
| 139 |
- usage: shibing624/text2vec-base-chinese (onnx-O4), for gpu
|
| 140 |
-
```
|
| 141 |
from sentence_transformers import SentenceTransformer
|
| 142 |
|
| 143 |
model = SentenceTransformer(
|
|
@@ -145,16 +145,17 @@ model = SentenceTransformer(
|
|
| 145 |
backend="onnx",
|
| 146 |
model_kwargs={"file_name": "model_O4.onnx"},
|
| 147 |
)
|
| 148 |
-
embeddings = model.encode(["
|
| 149 |
print(embeddings.shape)
|
| 150 |
-
|
| 151 |
similarities = model.similarity(embeddings, embeddings)
|
| 152 |
print(similarities)
|
| 153 |
```
|
| 154 |
|
| 155 |
|
| 156 |
- usage: shibing624/text2vec-base-chinese (ov), for cpu
|
| 157 |
-
```
|
|
|
|
|
|
|
| 158 |
from sentence_transformers import SentenceTransformer
|
| 159 |
|
| 160 |
model = SentenceTransformer(
|
|
@@ -162,15 +163,15 @@ model = SentenceTransformer(
|
|
| 162 |
backend="openvino",
|
| 163 |
)
|
| 164 |
|
| 165 |
-
embeddings = model.encode(["
|
| 166 |
print(embeddings.shape)
|
| 167 |
-
|
| 168 |
similarities = model.similarity(embeddings, embeddings)
|
| 169 |
print(similarities)
|
| 170 |
```
|
| 171 |
|
| 172 |
- usage: shibing624/text2vec-base-chinese (ov-qint8), for cpu
|
| 173 |
-
```
|
|
|
|
| 174 |
from sentence_transformers import SentenceTransformer
|
| 175 |
|
| 176 |
model = SentenceTransformer(
|
|
@@ -178,9 +179,8 @@ model = SentenceTransformer(
|
|
| 178 |
backend="onnx",
|
| 179 |
model_kwargs={"file_name": "model_qint8_avx512_vnni.onnx"},
|
| 180 |
)
|
| 181 |
-
embeddings = model.encode(["
|
| 182 |
print(embeddings.shape)
|
| 183 |
-
|
| 184 |
similarities = model.similarity(embeddings, embeddings)
|
| 185 |
print(similarities)
|
| 186 |
```
|
|
|
|
| 137 |
3. 🟡 shibing624/text2vec-base-chinese (ov-qint8), int8 quantization with OV incurs a small performance hit on some tasks, and a tiny performance gain on others, when quantizing with [Chinese STSB](https://huggingface.co/datasets/PhilipMay/stsb_multi_mt). Additionally, it results in a [4.78x speedup](https://sbert.net/docs/sentence_transformer/usage/efficiency.html#benchmarks) on CPU.
|
| 138 |
|
| 139 |
- usage: shibing624/text2vec-base-chinese (onnx-O4), for gpu
|
| 140 |
+
```python
|
| 141 |
from sentence_transformers import SentenceTransformer
|
| 142 |
|
| 143 |
model = SentenceTransformer(
|
|
|
|
| 145 |
backend="onnx",
|
| 146 |
model_kwargs={"file_name": "model_O4.onnx"},
|
| 147 |
)
|
| 148 |
+
embeddings = model.encode(["如何更换花呗绑定银行卡", "花呗更改绑定银行卡", "你是谁"])
|
| 149 |
print(embeddings.shape)
|
|
|
|
| 150 |
similarities = model.similarity(embeddings, embeddings)
|
| 151 |
print(similarities)
|
| 152 |
```
|
| 153 |
|
| 154 |
|
| 155 |
- usage: shibing624/text2vec-base-chinese (ov), for cpu
|
| 156 |
+
```python
|
| 157 |
+
# pip install 'optimum[openvino]'
|
| 158 |
+
|
| 159 |
from sentence_transformers import SentenceTransformer
|
| 160 |
|
| 161 |
model = SentenceTransformer(
|
|
|
|
| 163 |
backend="openvino",
|
| 164 |
)
|
| 165 |
|
| 166 |
+
embeddings = model.encode(["如何更换花呗绑定银行卡", "花呗更改绑定银行卡", "你是谁"])
|
| 167 |
print(embeddings.shape)
|
|
|
|
| 168 |
similarities = model.similarity(embeddings, embeddings)
|
| 169 |
print(similarities)
|
| 170 |
```
|
| 171 |
|
| 172 |
- usage: shibing624/text2vec-base-chinese (ov-qint8), for cpu
|
| 173 |
+
```python
|
| 174 |
+
# pip install optimum
|
| 175 |
from sentence_transformers import SentenceTransformer
|
| 176 |
|
| 177 |
model = SentenceTransformer(
|
|
|
|
| 179 |
backend="onnx",
|
| 180 |
model_kwargs={"file_name": "model_qint8_avx512_vnni.onnx"},
|
| 181 |
)
|
| 182 |
+
embeddings = model.encode(["如何更换花呗绑定银行卡", "花呗更改绑定银行卡", "你是谁"])
|
| 183 |
print(embeddings.shape)
|
|
|
|
| 184 |
similarities = model.similarity(embeddings, embeddings)
|
| 185 |
print(similarities)
|
| 186 |
```
|