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
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
light_embed-0.1.3.tar.gz
(8.6 kB
view details)
Built Distribution
File details
Details for the file light_embed-0.1.3.tar.gz
.
File metadata
- Download URL: light_embed-0.1.3.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59a0a121fcd64e703dfc813232c78ef9c00922bc98301c379b4f6357e23cd74a |
|
MD5 | 14235237ceb45544bbe37f0ed9f586a8 |
|
BLAKE2b-256 | 9f10a0510f39b33bb499aea936a4801df9fd49bad1107c78f523f30f62350125 |
File details
Details for the file light_embed-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: light_embed-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.0 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 | 6225c74a7526f44e11c2bfabc4d686295f9dada81b661023f9d5c9e39d7148c5 |
|
MD5 | 64044ae397a83815badea81534ceebf9 |
|
BLAKE2b-256 | 86c0ae28465a60ea6dd0f94186689b4daa798ba4ec6f5ce4638fe5e1ac87d5f0 |