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-awslambda

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_awslambda-0.1.3.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

light_embed_awslambda-0.1.3-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file light_embed_awslambda-0.1.3.tar.gz.

File metadata

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

File hashes

Hashes for light_embed_awslambda-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a4405c71756469fa2ff996eface7b65e9582badb229e4f3e29d795c9699a1ca8
MD5 6ddaf838059559d96709c121a3a36853
BLAKE2b-256 6f337ddb672dc86b85861b2e9743a8ee0b2644b21e1220166c54f3534700052c

See more details on using hashes here.

File details

Details for the file light_embed_awslambda-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for light_embed_awslambda-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 399b2825b43ef64bec9c2f63f93992e8cc950896bac428639bff337d50b3ca77
MD5 9c736c04725ee6c9f8cf1b16f3fcd52e
BLAKE2b-256 95ad877e3f7efcd561593bd102dbcf3caa091948749f9bb64f3315a2f91fc34e

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