Update README.md
Browse files
README.md
CHANGED
@@ -41,6 +41,37 @@ print(embeddings)
|
|
41 |
|
42 |
```
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
|
46 |
## Usage (HuggingFace Transformers)
|
|
|
41 |
|
42 |
```
|
43 |
|
44 |
+
## Usage (FastEmbed)
|
45 |
+
|
46 |
+
Using this model becomes easy when you have [FastEmbed](https://github.com/qdrant/fastembed) installed:
|
47 |
+
|
48 |
+
```
|
49 |
+
pip install fastembed
|
50 |
+
```
|
51 |
+
|
52 |
+
Then you can use the model like this:
|
53 |
+
|
54 |
+
```python
|
55 |
+
from fastembed import TextEmbedding
|
56 |
+
from fastembed.common.model_description import PoolingType, ModelSource
|
57 |
+
|
58 |
+
sentences = ["Una ragazza si acconcia i capelli.", "Una ragazza si sta spazzolando i capelli."]
|
59 |
+
|
60 |
+
TextEmbedding.add_custom_model(
|
61 |
+
model="nickprock/multi-sentence-BERTino",
|
62 |
+
pooling=PoolingType.MEAN,
|
63 |
+
normalization=True,
|
64 |
+
sources=ModelSource(hf="nickprock/multi-sentence-BERTino"), # can be used with an `url` to load files from a private storage
|
65 |
+
dim=768,
|
66 |
+
model_file="onnx/model_qint8_avx512_vnni.onnx", # can be used to load an already supported model with another optimization or quantization, e.g. onnx/model_O4.onnx
|
67 |
+
)
|
68 |
+
|
69 |
+
model = TextEmbedding(model_name="nickprock/multi-sentence-BERTino")
|
70 |
+
embeddings = list(model.embed(sentences))
|
71 |
+
print(embeddings)
|
72 |
+
|
73 |
+
```
|
74 |
+
|
75 |
|
76 |
|
77 |
## Usage (HuggingFace Transformers)
|