Compare commits

...
4 Commits
Author SHA1 Message Date
Anush008 6fe808628a docs: Updated README.md 2024-08-07 14:02:03 +05:30
Anush 9a828da000 Merge branch 'main' into remove-pystemmer 2024-08-07 13:54:52 +05:30
Anush008 63b2dad4d7 chore: Make Pystemmer optional 2024-08-07 13:54:03 +05:30
generall 9d2175e97b remove PyStemmer and see what happens 2024-07-23 22:38:55 +02:00
2 changed files with 28 additions and 10 deletions
+24 -9
View File
@@ -6,7 +6,7 @@ The default text embedding (`TextEmbedding`) model is Flag Embedding, presented
## 📈 Why FastEmbed?
1. Light: FastEmbed is a lightweight library with few external dependencies. We don't require a GPU and don't download GBs of PyTorch dependencies, and instead use the ONNX Runtime. This makes it a great candidate for serverless runtimes like AWS Lambda.
1. Light: FastEmbed is a lightweight library with few external dependencies. We don't require a GPU and don't download GBs of PyTorch dependencies, and instead use the ONNX Runtime. This makes it a great candidate for serverless runtimes like AWS Lambda.
2. Fast: FastEmbed is designed for speed. We use the ONNX Runtime, which is faster than PyTorch. We also use data parallelism for encoding large datasets.
@@ -48,6 +48,7 @@ len(embeddings_list[0]) # Vector of 384 dimensions
Fastembed supports a variety of models for different tasks and modalities.
The list of all the available models can be found [here](https://qdrant.github.io/fastembed/examples/Supported_Models/)
### 🎒 Dense text embeddings
```python
@@ -63,8 +64,6 @@ embeddings = list(model.embed(documents))
```
### 🔱 Sparse text embeddings
* SPLADE++
@@ -81,10 +80,23 @@ embeddings = list(model.embed(documents))
# ]
```
<!--
* BM42 - ([link](ToDo))
* BM25
```python
from fastembed import SparseTextEmbedding
model = SparseTextEmbedding(model_name="Qdrant/bm25")
embeddings = list(model.embed(documents))
# [
# SparseEmbedding(indices=[ 129793020, 1999429279, 819028769, ... ], values=[1.6477, 1.6327, 1.2377, ...]),
# SparseEmbedding(indices=[ 682147660, 1100855371, 339478471, ... ], values=[1.6741, 1.5432, 1.6741, ...])
# ]
```
* [BM42](https://qdrant.tech/articles/bm42/)
```python
from fastembed import SparseTextEmbedding
model = SparseTextEmbedding(model_name="Qdrant/bm42-all-minilm-l6-v2-attentions")
@@ -95,11 +107,15 @@ embeddings = list(model.embed(documents))
# SparseEmbedding(indices=[ 38, 12, 91, ... ], values=[0.11, 0.22, 0.39, ...])
# ]
```
-->
You can install [PyStemmer](https://pypi.org/project/PyStemmer/) to improve the stemming performance when using BM25, BM42.
```shell
pip install fastembed[pystemmer]
```
### 🦥 Late interaction models (aka ColBERT)
```python
from fastembed import LateInteractionTextEmbedding
@@ -137,7 +153,6 @@ embeddings = list(model.embed(images))
# ]
```
## ⚡️ FastEmbed on a GPU
FastEmbed supports running on GPU devices.
@@ -168,7 +183,7 @@ Installation with Qdrant Client in Python:
pip install qdrant-client[fastembed]
```
or
or
```bash
pip install qdrant-client[fastembed-gpu]
+4 -1
View File
@@ -25,8 +25,11 @@ numpy = [
]
pillow = "^10.3.0"
snowballstemmer = "^2.2.0"
PyStemmer = "^2.2.0"
mmh3 = "^4.0"
PyStemmer = { version = "^2.2.0", optional = true }
[tool.poetry.extras]
pystemmer = ["PyStemmer"]
[tool.poetry.group.dev.dependencies]
pytest = "^7.4.2"