Skip to main content

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

light_embed-0.1.2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

light_embed-0.1.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file light_embed-0.1.2.tar.gz.

File metadata

  • Download URL: light_embed-0.1.2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for light_embed-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4e568689d62f7b649a38349d6da3c9dd1908c34da4edd96288fc7105a6add708
MD5 3a004b06211fbb1edde9e7b6e8a2bba8
BLAKE2b-256 e5e55803797d1d01cc75cf16b8f07f14e82c9d53427663d3fa32fb8c5803bf4a

See more details on using hashes here.

File details

Details for the file light_embed-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: light_embed-0.1.2-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

Hashes for light_embed-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 74765fbaf632842401e0d5b4849f84dbf497dcedffef5199dfa436f24eda6672
MD5 0c97ebe1fa52fbd6a8574cb0ec7bd2f9
BLAKE2b-256 d04d37f7185aa0d9d6d68b059777c875ce449e79ee63a91ec14b3bcd68a357f0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page