Skip to main content

Embed anything at lightning speed

Project description

Framework for building local and multimodal embeddings built in Rust 🦀

Downloads Open in Colab license license

EmbedAnything is a powerful python library designed to streamline the creation and management of embedding pipelines. Whether you're working with text, images, audio, or any other type of data., EmbedAnything makes it easy to generate embeddings from multiple sources and store them efficiently in a vector database.

🦀The Benefit of Rust for Speed

By using Rust for its core functionalities, EmbedAnything offers significant speed advantages: Rust is Compiled: Unlike Python, Rust compiles directly to machine code, resulting in faster execution. Memory Management: Rust enforces memory management simultaneously, preventing memory leaks and crashes that can plague other languages. Rust achieves true multithreading.

🚀Why Candle?...

Running language models or embedding models locally can be difficult, especially when you want to deploy a product that utilizes these models. If you use the transformers library from Hugging Face in Python, you will depend on PyTorch for tensor operations. This, in turn, has a dependency on Libtorch, which means that you will need to include the entire Libtorch library with your product. Also, Candle allows inferences on CUDA-enabled GPUs right out of the box. We will soon post on how we use Candle to increase the performance and decrease the memory usage of EmbedAnything.

Examples

  1. Image Search: Open in Colab

Watch the demo

🚀 Key Features

  • Local Embedding Works with local embedding models like AllminiLM
  • MultiModality Works with text and image and will soon expand to audio
  • Python Interface: Packaged as a Python library for seamless integration into your existing projects.
  • Efficient: Optimized for speed and performance, with core functionality written in Rust.
  • Scalable: Store embeddings in a vector database for easy retrieval and scalability.
  • OpenAI Works with openai as well

💚 Installation

pip install embed-anything

🧑‍🚀 Getting Started

For local models

To use local embedding: we support Bert and Jina

import embed_anything
data = embed_anything.embed_file("filename.pdf", embeder= "Bert")
embeddings = np.array([data.embedding for data in data])

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
data = embed_anything.embed_directory("test_files", embeder= "Clip")
embeddings = np.array([data.embedding for data in data])

query = "photo of a dog"
query_embedding = np.array(embed_anything.embed_query(query, embeder= "Clip")[0].embedding)
similarities = np.dot(embeddings, query_embedding)
max_index = np.argmax(similarities)
Image.open(data[max_index].text).show()

For OpenAI

  1. Please check if you already have the OpenAI key in the Environment variable.

If you are using embed-anything==0.1.7 version (latest version)

import embed_anything
data = embed_anything.embed_file("filename.pdf", embeder= "OpenAI")
embeddings = np.array([data.embedding for data in data])

🚧 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.

Table of Content:

  1. [Code of conduct]
  2. [Quick Start]

✔️ Code of Conduct:

Please read our [Code of Conduct] to understand the expectations we have for all contributors participating in this project. By participating, you agree to abide by our Code of Conduct.

🚀 Quick Start

You can quickly get started with contributing by searching for issues with the labels "Good First Issue" or "Help Needed" in the [Issues Section]. If you think you can contribute, comment on the issue and we will assign it to you.

To set up your development environment, please follow the steps mentioned below :

  1. Fork the repository and create a clone of the fork
  2. Create a branch for a feature or a bug you are working on in your fork
  3. If you are working with OpenAI make sure you have the keys

Contributing Guidelines

🔍 Reporting Bugs

  1. Title describing the issue clearly and concisely with relevant labels
  2. Provide a detailed description of the problem and the necessary steps to reproduce the issue.
  3. Include any relevant logs, screenshots, or other helpful information supporting the issue.

💡 New Feature or Suggesting Enhancements

☑️ ToDo

  • Vector Database Add functionalities to integrate with any Vector Database

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-0.1.18.tar.gz (4.5 MB view details)

Uploaded Source

Built Distributions

embed_anything-0.1.18-cp312-none-win_amd64.whl (10.2 MB view details)

Uploaded CPython 3.12 Windows x86-64

embed_anything-0.1.18-cp310-cp310-manylinux_2_34_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.34+ x86-64

File details

Details for the file embed_anything-0.1.18.tar.gz.

File metadata

  • Download URL: embed_anything-0.1.18.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.5.1

File hashes

Hashes for embed_anything-0.1.18.tar.gz
Algorithm Hash digest
SHA256 f3d54f87cc7c4b3fc64be826fd1c7799663be340a8d9b1d9dbef8f53ae521445
MD5 4e94c066fa69ea225afcfb0c8361b80f
BLAKE2b-256 8795423b25e0bfe4f494bc543954a64f01ec65b92632d7285532db87ef85301c

See more details on using hashes here.

File details

Details for the file embed_anything-0.1.18-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for embed_anything-0.1.18-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 d9fdfee5270bdbb5e1d2c17859850a8e76856b483343cc1298368f50adfe8b85
MD5 cffc23a1f0177e25845028b42e9b554a
BLAKE2b-256 7e444a57dfbfaed6843202cc7cd0de3ab6a7c8be4f195d69a04edd21406c9d2b

See more details on using hashes here.

File details

Details for the file embed_anything-0.1.18-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for embed_anything-0.1.18-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 dd46cb7dfd950d569eaabca853d0a296b229425e75e6018f385027ead7743f00
MD5 ee315f45d492433883f2254d83822993
BLAKE2b-256 53ae094d72b95ec5250a39af8c2a9a8ae75351e5f10e4c59fc6eefaa381b7acd

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