Skip to main content

implementations of models and metrics for semantic text similarity. that's it.

Project description

semantic-text-similarity

an easy-to-use interface to fine-tuned BERT models for computing semantic similarity. that's it.

This project contains an interface to fine-tuned, BERT-based semantic text similarity models. It modifies pytorch-transformers by abstracting away all the research benchmarking code for ease of real-world applicability.

Model Training Dataset Dev. Correlation
Web STS BERT STS-B 0.893
Clinical STS BERT MED-STS

Installation

Install with pip:

pip install semantic-text-similarity

or directly:

pip install git+https://github.com/AndriyMulyar/semantic-text-similarity

Use

from semantic_text_similarity.models import WebBertSimilarity

model = WebBertSimilarity(device='cpu') #defaults to GPU prediction

model.predict([("She won an olympic gold medal","The women is an olympic champion")])

More examples.

Notes

  • You will need a GPU to apply these models if you would like any hint of speed in your predictions.
  • Model downloads are cached in ~/.cache/torch/semantic_text_similarity/. Try clearing this folder if you have issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for semantic-text-similarity, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size semantic_text_similarity-1.0.0-py3-none-any.whl (414.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size semantic_text_similarity-1.0.0.tar.gz (409.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page