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.1.tar.gz
(8.4 kB
view details)
Built Distribution
File details
Details for the file light_embed-0.1.1.tar.gz
.
File metadata
- Download URL: light_embed-0.1.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37defbf7ce4b3f15e6ee5d50a6587d607d460623105a4881126c3552c95a0ad9 |
|
MD5 | 1d10d635a02f50c7e2847aca50ebd4a5 |
|
BLAKE2b-256 | 7ac665d1134965b86816a1db1bbfaf31fc0f589f985119a3618d9507e69d80a3 |
File details
Details for the file light_embed-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: light_embed-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 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 | 99a9ec128b85f0521eaa3740fa91945d9aaa68456e036f2bd7419486845ef840 |
|
MD5 | 39a75dd4f89dc2fb085ee70477f65f0a |
|
BLAKE2b-256 | a2bc2a570b497de3bfbc37a4b5f567b176519bd6792c93a399dffb841eabd234 |