A lightweight open-source package to fine-tune embedding models.
Project description
Embedding Adapter 💬 📐
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file embedding_adapter-0.1.1.tar.gz
.
File metadata
- Download URL: embedding_adapter-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4892d725c65907933d34f73688f91a750b2757b76330cb36202aff513244ed42 |
|
MD5 | a9c34985292213574dda89488403276b |
|
BLAKE2b-256 | 306cc25f33d6b8a2493150d50fbf6b7de57b93beac494d680002a00cf5502f91 |
File details
Details for the file embedding_adapter-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: embedding_adapter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20b316c460beaed33a6d5e1cca181335b5b58fd91a8c9e314e955fab95ebde31 |
|
MD5 | 51ab71e3e3615cc02b8063204250e3d1 |
|
BLAKE2b-256 | c5ed444608c631d6ce2ccd45e7f42b227f21dc015723dc958c7159811c2f834b |