mirror of
https://github.com/qdrant/fastembed.git
synced 2026-07-31 23:20:55 -05:00
22a8260c1afa35d1b8d439d2d29a3d06cc9bc3b2
* docs(Getting Started.ipynb): update section headings and explanations * docs(Getting Started.ipynb): update section heading and explanation
FastEmbed Library
FastEmbed is light, built for retrieval and fast:
-
Light
- Quantized model weights
- ONNX Runtime for inference
- No hidden dependencies on PyTorch or TensorFlow via Huggingface Transformers
-
Accuracy/Recall
- Better than OpenAI Ada-002
- Default is Flag Embedding, which is top of the MTEB leaderboard
-
Fast
- About 2x faster than Huggingface (PyTorch) transformers on single queries
- Lot faster for batches!
- ONNX Runtime allows you to use dedicated runtimes for even higher throughput and lower latency
Installation
To install the FastEmbed library, we recommend using Poetry, alternatively -- pip works:
pip install fastembed
Usage
from fastembed.embedding import DefaultEmbedding
documents: List[str] = [
"Hello, World!",
"This is an example document.",
"fastembed is supported by and maintained by Qdrant." * 128,
]
# Initialize the DefaultEmbedding class with the desired parameters
# model_name="BAAI/bge-small-en"
embedding_model = DeafultEmbedding()
embeddings: List[np.ndarray] = list(embedding_model.encode(documents))
Description
Languages
Python
87%
Jupyter Notebook
13%