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
Built Distribution
Close
Hashes for next_word_prediction-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14f2bed9244f64107b982d4ee437d65c926fe5616dbb04bec97f52b1fe57d009 |
|
MD5 | faab683433aaa34a52464eec3f839143 |
|
BLAKE2b-256 | 5d4e9886136a81a58faa583323aa18a50d6a375d71e3a118cc1f56e1d42bdc1d |
Close
Hashes for next_word_prediction-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82fbd5afb016d8bb5683c6fc1a2884542792a5bad8dea46cb13a684e962e3b7c |
|
MD5 | 444389a8b709c28561418511845484ec |
|
BLAKE2b-256 | 2e4b859c502c14f4e5377183ab072a2a80deee1a91a68e27f6d843429da4b084 |