Skip to main content

A lightweight open-source package to fine-tune embedding models.

Project description

Embedding Adapter 💬 📐

PyPI version

Finetune embedding models in just 4 lines of code.

Quick Start ⚡

Installation

pip install embedding_adapter

Usage

from embedding_adapter import EmbeddingAdapter
adapter = EmbeddingAdapter()
EmbeddingAdapter.fit(query_embeddings, document_embeddings, labels)
EmbeddingAdapter.transform(new_embeddings)

Once you've trained the adapter, you can use patch your pre-trained embedding model.

patch = EmbeddingAdapter.patch()
adapted_embeddings = patch(original_embedding_fn("SAMPLE_TEXT"))

Synthetic Label Generation 🧪

No user feedback to use as labels? 🤔 Create synthetic labels with the LabelGenerator util

from embedding_adapter.utils import LabelGenerator
generator = LabelGenerator()
generator.run()

Note: This requires an OpenAI API key saved as an OPENAI_API_KEY env var.

License 📄

This project is licensed under the MIT License.

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

embedding_adapter-0.1.1.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

embedding_adapter-0.1.1-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

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