mirror of
https://github.com/qdrant/fastembed.git
synced 2026-07-23 11:20:51 -05:00
1010 B
1010 B
FastEmbed Library
FastEmbed optimises for being Accurate and Fast:
-
Accuracy/Recall
- Better than OpenAI Ada-002
- Top of the leaderboard from MTEB
-
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))