Skip to main content

Generative Pretrained Transformer 2 (GPT-2) for Language Modeling using the PyTorch-Transformers library.

Project description

Next Word Prediction

Generative Pretrained Transformer 2 (GPT-2) for Language Modeling using the PyTorch-Transformers library.

Installation

Requires python>=3.5, pytorch>=1.6.0, pytorch-transformers>=1.2.0

pip install next-word-prediction

How to use

>>> from next_word_prediction import GPT2
>>> gpt2 = GPT2()
>>> text = "The course starts next"
>>> gpt2.predict_next(text, 5)
The course starts next ['week', 'to', 'month', 'year', 'Monday']

Demo via Streamlit

streamlit run app/run.py

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

next_word_prediction-0.2.0.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

next_word_prediction-0.2.0-py3-none-any.whl (3.4 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