Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

EmbedAnything

> 数据库
Open source

Highly Performant, Modular, Memory Safe and Production-ready Inference, Ingestion and Indexing built in Rust

1.3K stars0 likes3 views
WebsiteGitHub

About

Highly Performant, Modular, Memory Safe and Production-ready Inference, Ingestion and Indexing built in Rust

EmbedAnything is a minimalist, yet highly performant, modular, lightning-fast, lightweight, multisource, multimodal, and local embedding pipeline built in Rust. Whether you're working with text, images, audio, PDFs, websites, or other media, EmbedAnything streamlines the process of generating embeddings from various sources and seamlessly streaming (memory-efficient-indexing) them to a vector database. It supports dense, sparse, ONNX, model2vec and late-interaction embeddings, offering flexibility for a wide range of use cases.

Table of Contents

  About The Project

Built With Rust

Why Candle?

  Getting Started

Installation

Usage

Roadmap

Contributing

How to add custom model and chunk size

Key Features

  • No Dependency on Pytorch: Easy to deploy on cloud, comes with low memory footprint.
  • Highly Modular : Choose any vectorDB adapter for RAG, with 1 line 1 word of code
  • Backend : Supports Candle, ONNX and cloud models
  • MultiModality : Works with text sources like PDFs, txt, md, Images JPG and Audio, .WAV
  • GPU support : Hardware acceleration on GPU as well.
  • Chunking : In-built chunking methods like semantic, late-chunking
  • Vector Streaming: : Separate file processing, Indexing and Inferencing on different threads, reduces latency.
  • AWS S3 Bucket: : Directly import AWS S3 bucket files.
  • Prebult Docker Image : Just pull it: starlightsearch/embedanything-server
  • SearchAgent : Example of how you can use index for Searchr1 reasoning.

What is Vector Streaming

Embedding models are computationally expensive and time-consuming. By separating document preprocessing from model inference, you can significantly reduce pipeline latency and improve throughput.

Vector streaming transforms a sequential bottleneck into an efficient, concurrent workflow.

The embedding process happens separetly from the main process, so as to maintain high performance enabled by rust MPSC, and no memory leak as embeddings are directly saved to vector database. Find our blog.

Why Embed Anything

➡️Faster execution.

➡️No Pytorch Dependency, thus low-memory footprint and easy to deploy on cloud.

➡️True multithreading

➡️Running embedding models locally and efficiently

➡️In-built chunking methods like semantic, late-chunking

➡️Supports range of models, Dense, Sparse, Late-interaction, ReRanker, ModernBert.

➡️Memory Management: Rust enforces memory management simultaneously, preventing memory leaks and crashes that can plague other languages

⚠️ WhichModel has been deprecated in pretrained_hf

Our Past Collaborations:

We have collaborated with reputed enterprise like Elastic, Weaviate, SingleStore, Milvus and Analytics Vidya Datahours

You can get in touch with us for further collaborations.

Benchmarks

Inference Speed benchmarks.

Only measures embedding model inference speed, on onnx-runtime. Code

Benchmarks with other fromeworks coming soon!!

⭐ Supported Models

We support any hugging-face models on Candle. And We also support ONNX runtime for BERT and ColPali.

How to add custom model on candle: from_pretrained_hf

⚠️ WhichModel has been deprecated in from_pretrained_hf

…
Model HF link
Jina Jina Models
Bert All Bert based models
CLIP openai/clip-*
Whisper OpenAI Whisper models
ColPali starlight-ai/colpali-v1.2-merged-onnx
Colbert answerdotai/answerai-colbert-small-v1, jinaai/jina-colbert-v2 and more
Splade Splade Models and other Splade like models
Model2Vec model2vec, minishlab/potion-base-8M
Qwen3-Embedding Qwen/Qwen3-Embedding-0.6B
Gemma3 google/embeddinggemma-300m and other Gemma3 embedding models
Reranker Jina Reranker Models, Xenova/bge-reranker, Qwen/Qwen3-Reranker-4B

Custom Pooling Strategy

By default, EmbedAnything uses the pooling method defined by the model. You can override it by passing a Pooling strategy to from_pretrained_hf. This is useful when a checkpoint ships without pooling config, or when you want to reproduce a specific sentence-embedding recipe.

python
from embed_anything import EmbeddingModel, Pooling

# Available strategies: Pooling.Mean, Pooling.Cls, Pooling.LastToken
model = EmbeddingModel.from_pretrained_hf(
    model_id="sentence-transformers/all-MiniLM-L6-v2",
    pooling=Pooling.Mean,   # mean-pool token embeddings (matches sentence-transformers)
)

data = embed_anything.embed_query(["What is mean pooling?"], embedder=model)
Strategy Description
Pooling.Mean Averages token embeddings (weighted by the attention mask).
Pooling.Cls Uses the [CLS] / first-token embedding.
Pooling.LastToken Uses the last non-padding token (common for causal/LLM encoders).

Authentication (Private & Gated Models)

To load private or gated repositories (for example google/embeddinggemma-300m), pass a Hugging Face access token. If token is omitted, EmbedAnything falls back to the HF_TOKEN environment variable or your local huggingface-cli login credentials.

python
from embed_anything import EmbeddingModel

model = EmbeddingModel.from_pretrained_hf(
    model_id="google/embeddinggemma-300m",
    token="hf_your_access_token",   # or set the HF_TOKEN environment variable
)

Splade Models (Sparse Embeddings)

Sparse embeddings are useful for keyword-based retrieval and hybrid search scenarios.

…

ONNX-Runtime: from_pretrained_onnx

ONNX models provide faster inference and lower memory usage. Use the ONNXModel enum for pre-configured models or provide a custom model path.

BERT Models

python
import embed_anything
from embed_anything import EmbeddingModel, WhichModel, ONNXModel, Dtype, TextEmbedConfig

# Option 2: Use a custom ONNX model from Hugging Face
model = EmbeddingModel.from_pretrained_onnx(
    WhichModel.Bert
    model_id="onnx_model_link",
    dtype=Dtype.F16  # Use half precision for faster inference
)

Cloud Embedding Models (Cohere Embed v4)

Use cloud models for high-quality embeddings without local model deployment.

python
import embed_anything
from embed_anything import EmbeddingModel, WhichModel
import os

# Set your API key
os.environ["COHERE_API_KEY"] = "your-api-key-here"

# Initialize the cloud model
model = EmbeddingModel.from_pretrained_cloud(
    WhichModel.CohereVision, 
    model_id="embed-v4.0"
)

# Use it like any other model
data = embed_anything.embed_file("test_files/document.pdf", embedder=model)

For Semantic Chunking

Semantic chunking preserves meaning by splitting text at semantically meaningful boundaries rather than fixed sizes.

…

For Late-Chunking

Late-chunking splits text into smaller units first, then combines them during embedding for better context preservation.

…

‍ Getting Started

Installation

pip install embed-anything

For GPUs and using special models like ColPali

pip install embed-anything-gpu

❌ If it shows cuda error while running on windowns, run the following command:

os.add_dll_directory("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin")

Notebooks

End-to-End Retrieval and Reranking using VectorDB Adapters
ColPali-Onnx
Adapters
Qwen3- Embedings
Benchmarks

Advanced Usage with Configuration

…

Embedding Queries

python

# Embed a query
queries = ["What is machine learning?", "How does neural networks work?"]
query_embeddings = embed_anything.embed_query(queries, embedder=model)

# Use embeddings for similarity search
for i, query_emb in enumerate(query_embeddings):
    print(f"Query: {queries[i]}")
    print(f"Embedding shape: {len(query_emb.embedding)}")

Embedding Directories

python

# Embed all files in a directory
data = embed_anything.embed_directory(
    "test_files/", 
    embedder=model, 
    config=config
)

print(f"Total chunks: {len(data)}")

Using Custom ONNX Models

For custom or fine-tuned models, specify the Hugging Face model ID and path to the ONNX file:

python
import embed_anything
from embed_anything import EmbeddingModel, WhichModel, Dtype

# Load a custom ONNX model from Hugging Face
model = EmbeddingModel.from_pretrained_onnx(
    WhichModel.Jina,
    hf_model_id="jinaai/jina-embeddings-v2-small-en",
    path_in_repo="model.onnx",  # Path to ONNX file in the repo
    dtype=Dtype.F16              # Use half precision
)

# Use the model
data = embed_anything.embed_file("test_files/document.pdf", embedder=model)

Note: Using pre-configured models (via ONNXModel enum) is recommended as these models are tested and optimized. For a complete list of supported ONNX models, see ONNX Models Guide.

⁉️FAQ

Do I need to know rust to use or contribute to embedanything?

The answer is No. EmbedAnything provides you pyo3 bindings, so you can run any function in python without any issues. To contibute you should check out our guidelines and python folder example of adapters.

How is it different from fastembed?

We provide both backends, candle and onnx. On top of it we also give an end-to-end pipeline, that is you can ingest different data-types and index to any vector database, and inference any model. Fastembed is just an onnx-wrapper.

We've received quite a few questions about why we're using Candle.

One of the main reasons is that Candle doesn't require any specific ONNX format models, which means it can work seamlessly with any Hugging Face model. This flexibility has been a key factor for us. However, we also recognize that we’ve been compromising a bit on speed in favor of that flexibility.

macOS: I get use of undeclared identifier 'bfloat' with Metal

This happens when a Candle model runs on Metal under a Python interpreter that was built against an old macOS SDK (common with conda/Anaconda Pythons, which report macOS 11–12). Metal then defaults to a Shading Language version where bfloat doesn't exist. The published wheel is fine — you just need a Python whose SDK is macOS 14+ (e.g. a Homebrew Python), or relink your ex

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustaicloudgenerative-aihacktoberfest

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库