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.0.tar.gz
.
File metadata
- Download URL: light_embed_awslambda-0.1.0.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 | 5ed2da71a39f2a126988b05ed3bdeaf918f829338269e9f335da146ed52434e7 |
|
MD5 | 6bcb4b0f22f49a720562ab2050fab063 |
|
BLAKE2b-256 | 6f1bbb758ab1474c285efd21888b8fb4e7378b7cfe173fa6b0746ab628da7ba2 |
File details
Details for the file light_embed_awslambda-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: light_embed_awslambda-0.1.0-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 | 72f2ca637f26c990ca3d47bad9a8ad52cb14498cc481843aadab81455b85f8eb |
|
MD5 | 2666716ec76d0bf83211658a88fd0237 |
|
BLAKE2b-256 | 0ab3a30ac681dc6b03253ef6787769ef97a14d6799d303126d8a831bc86c5381 |