Skip to main content

A Tensorflow SentenceTransformer layer that takes in strings as input.

Project description

tf-sentence-transformers

A simple tensorflow/keras wrapper around sentence-transformers. The main class is SentenceTransformer, a keras.Layer that can be constructed from a pretrained checkpoint in huggingface model hub.

Example usage:

from tf_sentence_transformers import SentenceTransformer

layer = SentenceTransformer.from_pretrained(
    "sentence-transformers/all-MiniLM-L6-v2"
)
inputs = [
    ["This is a test sentence."],
    ["This is another test sentence."],
]
embedding = layer(inputs)
# assert embedding.shape == (2, 384)

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

tf_sentence_transformers-0.2.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

tf_sentence_transformers-0.2-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

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