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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

next_word_prediction-0.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file next_word_prediction-0.2.0.tar.gz.

File metadata

  • Download URL: next_word_prediction-0.2.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.0

File hashes

Hashes for next_word_prediction-0.2.0.tar.gz
Algorithm Hash digest
SHA256 14f2bed9244f64107b982d4ee437d65c926fe5616dbb04bec97f52b1fe57d009
MD5 faab683433aaa34a52464eec3f839143
BLAKE2b-256 5d4e9886136a81a58faa583323aa18a50d6a375d71e3a118cc1f56e1d42bdc1d

See more details on using hashes here.

File details

Details for the file next_word_prediction-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: next_word_prediction-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.0

File hashes

Hashes for next_word_prediction-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82fbd5afb016d8bb5683c6fc1a2884542792a5bad8dea46cb13a684e962e3b7c
MD5 444389a8b709c28561418511845484ec
BLAKE2b-256 2e4b859c502c14f4e5377183ab072a2a80deee1a91a68e27f6d843429da4b084

See more details on using hashes here.

Supported by

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