Skip to main content

Embed anything at lightning speed

Project description

Downloads Open in Colab gpu package roadmap roadmap

Generate and stream embeddings with minimalist and lightning fast framework built in rust 🦀
Explore the docs »

View Demo · Examples · Vector Streaming Adapters . Search in Audio Space

EmbedAnything is a minimalist yet highly performant, lightweight, lightening fast, multisource, multimodal and local embedding pipeline, built in rust. Whether you're working with text, images, audio, PDFs, websites, or other media, EmbedAnything simplifies the process of generating embeddings from various sources and streaming them to a vector database.We support dense, sparse and late-interaction embeddings.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. How to add custom model and chunk size

🚀 Key Features

  • Local Embedding : Works with local embedding models like BERT and JINA
  • ColPali : Support for ColPali in GPU version
  • Splade : Support for sparse embeddings for hybrid
  • Cloud Embedding Models:: Supports OpenAI and Cohere.
  • MultiModality : Works with text sources like PDFs, txt, md, Images JPG and Audio, .WAV
  • Rust : All the file processing is done in rust for speed and efficiency
  • Candle : We have taken care of hardware acceleration as well, with Candle.
  • Python Interface: Packaged as a Python library for seamless integration into your existing projects.
  • Vector Streaming: Continuously create and stream embeddings if you have low resource.

💡What is Vector Streaming

Vector Streaming enables you to process and generate embeddings for files and stream them, so if you have 10 GB of file, it can continuously generate embeddings Chunk by Chunk, that you can segment semantically, and store them in the vector database of your choice, Thus it eliminates bulk embeddings storage on RAM at once.

EmbedAnythingXWeaviate

🦀 Why Embed Anything

➡️Faster execution.
➡️Memory Management: Rust enforces memory management simultaneously, preventing memory leaks and crashes that can plague other languages
➡️True multithreading
➡️Running language models or embedding models locally and efficiently
➡️Candle allows inferences on CUDA-enabled GPUs right out of the box.
➡️Decrease the memory usage of EmbedAnything.

⭐ Supported Models

We support a range of models, that can be supported by Candle, We have given a set of tested models but if you have specific usecase do mention it in the issue.

How to add custom model and Chunk Size And Semantic Chunking.

model = EmbeddingModel.from_pretrained_hf(
    WhichModel.Bert, model_id="model link from huggingface"
)
config = TextEmbedConfig(chunk_size=200, batch_size=32)
data = embed_anything.embed_file("file_address", embeder=model, config=config)
Model Custom link
Jina jinaai/jina-embeddings-v2-base-en
jinaai/jina-embeddings-v2-small-en
Bert sentence-transformers/all-MiniLM-L6-v2
sentence-transformers/all-MiniLM-L12-v2
sentence-transformers/paraphrase-MiniLM-L6-v2
Clip openai/clip-vit-base-patch32
Whisper Most OpenAI Whisper from huggingface supported.

Splade Models:


model = EmbeddingModel.from_pretrained_hf(
    WhichModel.SparseBert, "prithivida/Splade_PP_en_v1"
)

ColPali Models Only runs with embed-anything-gpu

model: ColpaliModel = ColpaliModel.from_pretrained("vidore/colpali-v1.2-merged", None)

For Semantic Chunking

model = EmbeddingModel.from_pretrained_hf(
    WhichModel.Bert, model_id="sentence-transformers/all-MiniLM-L12-v2"
)

# with semantic encoder
semantic_encoder = EmbeddingModel.from_pretrained_hf(WhichModel.Jina, model_id = "jinaai/jina-embeddings-v2-small-en")
config = TextEmbedConfig(chunk_size=256, batch_size=32, splitting_strategy = "semantic", semantic_encoder=semantic_encoder)

🧑‍🚀 Getting Started

💚 Installation

pip install embed-anything

For GPUs and using special models like ColPali

pip install embed-anything-gpu

Usage

➡️ Usage For 0.3 and later version

To use local embedding: we support Bert and Jina

model = EmbeddingModel.from_pretrained_local(
    WhichModel.Bert, model_id="Hugging_face_link"
)
data = embed_anything.embed_file("test_files/test.pdf", embeder=model)

For multimodal embedding: we support CLIP

Requirements Directory with pictures you want to search for example we have test_files with images of cat, dogs etc

import embed_anything
from embed_anything import EmbedData
model = embed_anything.EmbeddingModel.from_pretrained_local(
    embed_anything.WhichModel.Clip,
    model_id="openai/clip-vit-base-patch16",
    # revision="refs/pr/15",
)
data: list[EmbedData] = embed_anything.embed_directory("test_files", embeder=model)
embeddings = np.array([data.embedding for data in data])
query = ["Photo of a monkey?"]
query_embedding = np.array(
    embed_anything.embed_query(query, embeder=model)[0].embedding
)
similarities = np.dot(embeddings, query_embedding)
max_index = np.argmax(similarities)
Image.open(data[max_index].text).show()

Audio Embedding using Whisper

requirements: Audio .wav files.

import embed_anything
from embed_anything import (
    AudioDecoderModel,
    EmbeddingModel,
    embed_audio_file,
    TextEmbedConfig,
)
# choose any whisper or distilwhisper model from https://huggingface.co/distil-whisper or https://huggingface.co/collections/openai/whisper-release-6501bba2cf999715fd953013
audio_decoder = AudioDecoderModel.from_pretrained_hf(
    "openai/whisper-tiny.en", revision="main", model_type="tiny-en", quantized=False
)
embeder = EmbeddingModel.from_pretrained_hf(
    embed_anything.WhichModel.Bert,
    model_id="sentence-transformers/all-MiniLM-L6-v2",
    revision="main",
)
config = TextEmbedConfig(chunk_size=200, batch_size=32)
data = embed_anything.embed_audio_file(
    "test_files/audio/samples_hp0.wav",
    audio_decoder=audio_decoder,
    embeder=embeder,
    text_embed_config=config,
)
print(data[0].metadata)

🚧 Contributing to EmbedAnything

First of all, thank you for taking the time to contribute to this project. We truly appreciate your contributions, whether it's bug reports, feature suggestions, or pull requests. Your time and effort are highly valued in this project. 🚀

This document provides guidelines and best practices to help you to contribute effectively. These are meant to serve as guidelines, not strict rules. We encourage you to use your best judgment and feel comfortable proposing changes to this document through a pull request.

  • Roadmap
  • Quick Start
  • Guidelines
  • 🏎️ RoadMap

    Accomplishments

    One of the aims of EmbedAnything is to allow AI engineers to easily use state of the art embedding models on typical files and documents. A lot has already been accomplished here and these are the formats that we support right now and a few more have to be done.

    🖼️ Modalities and Source

    We’re excited to share that we've expanded our platform to support multiple modalities, including:

    • Audio files

    • Markdowns

    • Websites

    • Images

    • Videos

    • Graph

    This gives you the flexibility to work with various data types all in one place! 🌐

    💜 Product

    We’ve rolled out some major updates in version 0.3 to improve both functionality and performance. Here’s what’s new:

    • Semantic Chunking: Optimized chunking strategy for better Retrieval-Augmented Generation (RAG) workflows.

    • Streaming for Efficient Indexing: We’ve introduced streaming for memory-efficient indexing in vector databases. Want to know more? Check out our article on this feature here: https://www.analyticsvidhya.com/blog/2024/09/vector-streaming/

    • Zero-Shot Applications: Explore our zero-shot application demos to see the power of these updates in action.

    • Intuitive Functions: Version 0.3 includes a complete refactor for more intuitive functions, making the platform easier to use.

    • Chunkwise Streaming: Instead of file-by-file streaming, we now support chunkwise streaming, allowing for more flexible and efficient data processing.

    Check out the latest release : and see how these features can supercharge your GenerativeAI pipeline! ✨

    🚀Coming Soon

    ⚙️ Performance

    We've received quite a few questions about why we're using Candle, so here's a quick explanation:

    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.

    What’s Next? To address this, we’re excited to announce that we’re introducing Candle-ONNX along with our previous framework on hugging-face ,

    ➡️ Support for GGUF models

    • Significantly faster performance
    • Stay tuned for these exciting updates! 🚀

    🫐Embeddings:

    We had multimodality from day one for our infrastructure. We have already included it for websites, images and audios but we want to expand it further to.

    ☑️Graph embedding -- build deepwalks embeddings depth first and word to vec
    ☑️Video Embedding
    ☑️ Yolo Clip

    🌊Expansion to other Vector Adapters

    We currently support a wide range of vector databases for streaming embeddings, including:

    • Elastic: thanks to amazing and active Elastic team for the contribution
    • Weaviate
    • Pinecone
    • Qdrant

    But we're not stopping there! We're actively working to expand this list.

    Want to Contribute? If you’d like to add support for your favorite vector database, we’d love to have your help! Check out our contribution.md for guidelines, or feel free to reach out directly starlight-search@proton.me. Let's build something amazing together! 💡

    Project details


    Download files

    Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

    Source Distribution

    embed_anything_gpu-0.4.14.tar.gz (946.8 kB view details)

    Uploaded Source

    Built Distributions

    embed_anything_gpu-0.4.14-cp312-none-win_amd64.whl (12.7 MB view details)

    Uploaded CPython 3.12 Windows x86-64

    embed_anything_gpu-0.4.14-cp312-cp312-manylinux_2_34_x86_64.whl (16.8 MB view details)

    Uploaded CPython 3.12 manylinux: glibc 2.34+ x86-64

    embed_anything_gpu-0.4.14-cp312-cp312-manylinux_2_31_x86_64.whl (15.2 MB view details)

    Uploaded CPython 3.12 manylinux: glibc 2.31+ x86-64

    embed_anything_gpu-0.4.14-cp311-none-win_amd64.whl (12.7 MB view details)

    Uploaded CPython 3.11 Windows x86-64

    embed_anything_gpu-0.4.14-cp311-cp311-manylinux_2_34_x86_64.whl (16.8 MB view details)

    Uploaded CPython 3.11 manylinux: glibc 2.34+ x86-64

    embed_anything_gpu-0.4.14-cp311-cp311-manylinux_2_31_x86_64.whl (15.2 MB view details)

    Uploaded CPython 3.11 manylinux: glibc 2.31+ x86-64

    embed_anything_gpu-0.4.14-cp310-none-win_amd64.whl (12.7 MB view details)

    Uploaded CPython 3.10 Windows x86-64

    embed_anything_gpu-0.4.14-cp310-cp310-manylinux_2_34_x86_64.whl (16.8 MB view details)

    Uploaded CPython 3.10 manylinux: glibc 2.34+ x86-64

    embed_anything_gpu-0.4.14-cp310-cp310-manylinux_2_31_x86_64.whl (15.2 MB view details)

    Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

    embed_anything_gpu-0.4.14-cp310-cp310-macosx_11_0_arm64.whl (10.9 MB view details)

    Uploaded CPython 3.10 macOS 11.0+ ARM64

    embed_anything_gpu-0.4.14-cp39-none-win_amd64.whl (12.7 MB view details)

    Uploaded CPython 3.9 Windows x86-64

    embed_anything_gpu-0.4.14-cp39-cp39-manylinux_2_34_x86_64.whl (16.8 MB view details)

    Uploaded CPython 3.9 manylinux: glibc 2.34+ x86-64

    embed_anything_gpu-0.4.14-cp39-cp39-manylinux_2_31_x86_64.whl (15.2 MB view details)

    Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

    embed_anything_gpu-0.4.14-cp39-cp39-macosx_11_0_arm64.whl (10.9 MB view details)

    Uploaded CPython 3.9 macOS 11.0+ ARM64

    embed_anything_gpu-0.4.14-cp38-none-win_amd64.whl (12.7 MB view details)

    Uploaded CPython 3.8 Windows x86-64

    embed_anything_gpu-0.4.14-cp38-cp38-manylinux_2_31_x86_64.whl (15.2 MB view details)

    Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

    File details

    Details for the file embed_anything_gpu-0.4.14.tar.gz.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14.tar.gz
    Algorithm Hash digest
    SHA256 d45ecab3bfef51f3b6a71d56c5af9ecb1a2042a0441cb0d90d26b515d75f0628
    MD5 84d6e3978dd6bb5bda271795bbb3605e
    BLAKE2b-256 9119466e343ef78cce7b4184a8beb7b7f1471b171cc82c1b6c59e8da993f46e9

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp312-none-win_amd64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp312-none-win_amd64.whl
    Algorithm Hash digest
    SHA256 14ab7ae57c218d93b2b74c5e83f399e3b1436eef4463599cf1bbc4b0f7ede310
    MD5 9c89eeb60d33890abec91ed4f36431e1
    BLAKE2b-256 5a6c3c0d61e14b5b53bb5699daa9e9cbd8a2fb2838cf92a32689778ccc1845ee

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp312-cp312-manylinux_2_34_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp312-cp312-manylinux_2_34_x86_64.whl
    Algorithm Hash digest
    SHA256 4b88b67861dc5d685180bc0ce3d148181b4736dc471a8d5224d3c4c87d546414
    MD5 275e4168fb11bf30a2294fe8af613538
    BLAKE2b-256 65b515912fc33ffc2df1b211432f9f582462e95d1c1d9fb90cd58ece167c2c18

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp312-cp312-manylinux_2_31_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp312-cp312-manylinux_2_31_x86_64.whl
    Algorithm Hash digest
    SHA256 41952c9aba4ec870f39761ec02822ce07514cb399ae1d83e8dbf5fd16dc40353
    MD5 4e95da57c439fc21bdbf5a4bbe7e9eec
    BLAKE2b-256 1c317472c07b47dc3c3738b48aa3819a182b7da4b688d5562968a8b748aaf344

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp311-none-win_amd64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp311-none-win_amd64.whl
    Algorithm Hash digest
    SHA256 2f8a5b9b2f3de26cd3560dc4d57cd2d7ee4dd9ffb917657b281f6ddd82e5ef54
    MD5 713b0a690c2289c90103572bd66abc3d
    BLAKE2b-256 b761c52439e28720891d56e3ed8d1a76f3d361384dc542d5ad538cea9b15e156

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp311-cp311-manylinux_2_34_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp311-cp311-manylinux_2_34_x86_64.whl
    Algorithm Hash digest
    SHA256 9c5373b29b7693796d99def134cd33bf664bd0ac0677ed35be420ed68ac127fb
    MD5 f344389f42f17ea3511325cf4cbb9273
    BLAKE2b-256 7d9df29e8c791f8c7a764d3877edd7b5af0f460258f442d442c6a0b7675edbaa

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp311-cp311-manylinux_2_31_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp311-cp311-manylinux_2_31_x86_64.whl
    Algorithm Hash digest
    SHA256 a61f8b1910e32c21729a308063c84b17c916f6646e14f1521650ebd74b8501e7
    MD5 02960d00f9e1a7fd0be2b758c3f31433
    BLAKE2b-256 1bff113e46b37a2577dd88e305992bebd972d8d39df1992d2bca83f14833d118

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp310-none-win_amd64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp310-none-win_amd64.whl
    Algorithm Hash digest
    SHA256 84e3607289165988ed69f6635974f765abaec893e5c7706f5dba119c7f343030
    MD5 ef3505aa15d1cbaec63d72195b186ee9
    BLAKE2b-256 e6405b2e2df6a71345fe33725170db533338526979ab3424c130a413b68c7417

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp310-cp310-manylinux_2_34_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp310-cp310-manylinux_2_34_x86_64.whl
    Algorithm Hash digest
    SHA256 55396ecf62d64eb7a2a91f6d30141cea7ac4017a17ad9a4cff5b5b73ecc16785
    MD5 c188a5769b42fedaa69f7b7bc696beac
    BLAKE2b-256 e98144b0cd8b7942c7a76a9781544246a70ade204a6483c9d81d94cc79009be9

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp310-cp310-manylinux_2_31_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp310-cp310-manylinux_2_31_x86_64.whl
    Algorithm Hash digest
    SHA256 416f34f8b91fa2c20acf9bb466110e32e8aa94a1242817bbf91357efd5e5939f
    MD5 3a686721b0810d5d1d73b6ff30bf8b41
    BLAKE2b-256 a96aaa6680c88951f52b2a145761081391ece94135a5733dd8d50c33665d1d40

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp310-cp310-macosx_11_0_arm64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp310-cp310-macosx_11_0_arm64.whl
    Algorithm Hash digest
    SHA256 b479449763576caba608afe00c6e71dcc41cbce52fa93574bedf4396fcb2b493
    MD5 07c32f895e53017d67dedca3c981af9d
    BLAKE2b-256 4b26f36bb8ac8c2a51cabf01029a4b30d933719e9a03494e4cad81f203410a09

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp39-none-win_amd64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp39-none-win_amd64.whl
    Algorithm Hash digest
    SHA256 fe59d0bebeb357cd15a03243c643245c17c25dcc160b5d9453173e9b6b04aa31
    MD5 7099e9cc0e64ff99ee0a63bbb71adb72
    BLAKE2b-256 5bc0c0f86584b80f8983e1aa1539a120d47d2c0729125938f77537023bd13d75

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp39-cp39-manylinux_2_34_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp39-cp39-manylinux_2_34_x86_64.whl
    Algorithm Hash digest
    SHA256 ba462e7109ca0d834da8ec5f5e5b935a87acf93b758205ccae1ac21af3af4e2c
    MD5 dc66f36539feb62cb154f1b6da15da55
    BLAKE2b-256 05bf02f4568cb416d2b287fb4df006d07645467a75dfcbdb05a6cf7446a6b28e

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp39-cp39-manylinux_2_31_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp39-cp39-manylinux_2_31_x86_64.whl
    Algorithm Hash digest
    SHA256 5fc5f618ed44a7c38ce0c58612d0dddc68ac5f6f27fa0ef8773a3061a5563bd6
    MD5 a16b399f845cc990a9cd975654b733f0
    BLAKE2b-256 b4ca66a61e97b26243b64b093a0ec80acaf2d27937d4991864df423d09a5b634

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp39-cp39-macosx_11_0_arm64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp39-cp39-macosx_11_0_arm64.whl
    Algorithm Hash digest
    SHA256 26ce3a20450b57cbf7af41a4511ed45fb541c4155c550dc4942f7e4c4ee28074
    MD5 8d04e1280efedfd5abf263033cbc95a5
    BLAKE2b-256 9fa0fad93d4b93a89bc3d54b2b7f1d4ee980fb6e075930d3ac4ce55961b910b0

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp38-none-win_amd64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp38-none-win_amd64.whl
    Algorithm Hash digest
    SHA256 1a21f6fbf050c2c47c6a3710ddcd478cc3634dcacd0c0eeec9393704ddb07850
    MD5 4ed906d9af329159dd330742e049f13e
    BLAKE2b-256 8c9b63637d0aa4d522b908270df22405aa9d54eef7ea883de364145eefcb8c81

    See more details on using hashes here.

    File details

    Details for the file embed_anything_gpu-0.4.14-cp38-cp38-manylinux_2_31_x86_64.whl.

    File metadata

    File hashes

    Hashes for embed_anything_gpu-0.4.14-cp38-cp38-manylinux_2_31_x86_64.whl
    Algorithm Hash digest
    SHA256 ef00faaee6c881066fedb7ff15b19b59fd3986c5fc0842103c42bafb2620e1e3
    MD5 691657003c84556ab4ad2b3822c2fa5f
    BLAKE2b-256 8cf716855c34eba7e697c316ed134f26bd625d0563282e68587e58845f14992f

    See more details on using hashes here.

    Supported by

    AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page