Fast and Lightweight Text Embedding
Project description
LightEmbed
LightEmbed is a light-weight, fast, and efficient tool for generating sentence embeddings. It does not rely on heavy dependencies like PyTorch and Transformers, making it suitable for environments with limited resources.
Benefits
1. Light-weight
- Minimal Dependencies: LightEmbed does not depend on PyTorch and Transformers.
- Low Resource Requirements: Operates smoothly with minimal specs: 1GB RAM, 1 CPU, and no GPU required.
2. Fast (as light)
- ONNX Runtime: Utilizes the ONNX runtime, which is significantly faster compared to Sentence Transformers that use PyTorch.
3. Same as Original Sentence Transformers' Outputs
- Consistency: Incorporates all modules from a Sentence Transformer model, including normalization and pooling.
- Accuracy: Produces embedding vectors identical to those from Sentence Transformers.
Installation
pip install -U light-embed
Usage
Then you can use the model like this:
from light_embed import TextEmbedding
sentences = ["This is an example sentence", "Each sentence is converted"]
model = TextEmbedding('sentence-transformers-model-name')
embeddings = model.encode(sentences)
print(embeddings)
For example:
from light_embed import TextEmbedding
sentences = ["This is an example sentence", "Each sentence is converted"]
model = TextEmbedding('sentence-transformers/all-MiniLM-L6-v2')
embeddings = model.encode(sentences)
print(embeddings)
Citing & Authors
Binh Nguyen / binhcode25@gmail.com
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
Built Distribution
File details
Details for the file light_embed_awslambda-0.1.1.tar.gz
.
File metadata
- Download URL: light_embed_awslambda-0.1.1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f78ba1e8388e3997eb54a07fba4e21e2388a1ae58f2e279fcef64c8182928206 |
|
MD5 | 7cbec16b51348dc684d5681f5b0b9a5e |
|
BLAKE2b-256 | deb8be7663bfebfbad40e4885af7d3bdc11ae3399519031f74c66fcb5b1efff1 |
File details
Details for the file light_embed_awslambda-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: light_embed_awslambda-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e210b7a25f43c34b67b22e469c26f6124c38ee9a74d1be375cb3ec5b947847 |
|
MD5 | 233f1067929e3e674027b528df5429ed |
|
BLAKE2b-256 | 30819911c65197ab7e0d4679d4144f9d93e71b6cc4b76e08cdeaa0f1f27c643c |