fastembed
快速、準確、輕量的 Python 嵌入函式庫。
fastembed 是什麼?
一個快速、準確、輕量的 Python 函式庫,用於產生最先進的嵌入。
fastembed 概覽
這是什麼
FastEmbed 是一個輕量、快速的 Python 函式庫,用於生成嵌入向量。它使用 ONNX Runtime 而非 PyTorch,因此減少了外部依賴,且無需 GPU 即可執行。該函式庫支援多種主流文字模型,並由 Qdrant 維護。
主要功能
- 輕量級,外部依賴少;不需要 GPU,也無需下載大型 PyTorch 套件。
- 使用 ONNX Runtime 和資料並行處理,實現快速編碼大型資料集。
- 支援稠密文字嵌入、稀疏文字嵌入(SPLADE++)、延遲互動模型(ColBERT)、圖片嵌入以及延遲互動多模態模型(ColPali)。
- 透過文字交叉編碼器提供重新排序功能。
- 允許從 Hugging Face 或私有儲存空間加入自訂模型。
- 透過
fastembed-gpu套件支援 GPU 運算。
使用情境
- 為檢索增強生成(RAG)流程生成嵌入向量。
- 在 AWS Lambda 等無伺服器環境中執行嵌入生成。
- 搭配 Qdrant 或其他向量資料庫建立搜尋與相似度應用。
- 使用支援的多語言模型處理多語言嵌入任務。
快速開始
bash pip install fastembed # 或搭配 GPU 支援 pip install fastembed-gpu python from fastembed import TextEmbedding documents = [ 'This is built to be faster and lighter than other embedding libraries e.g. Transformers, Sentence-Transformers, etc.', 'fastembed is supported by and maintained by Qdrant.', ] embedding_model = TextEmbedding() embeddings_list = list(embedding_model.embed(documents))
授權與價格
授權為 Apache-2.0。此專案為開源,未提及任何價格資訊。
內容整理自該專案公開的 README 與儲存庫資訊。