项目作者: rdgozum

项目描述 :
Generative Pretrained Transformer 2 (GPT-2) for Language Modeling using the PyTorch-Transformers library.
高级语言: Python
项目地址: git://github.com/rdgozum/next-word-prediction.git
创建时间: 2020-09-11T12:48:23Z
项目社区:https://github.com/rdgozum/next-word-prediction

开源协议:MIT License

下载


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

  1. pip install next-word-prediction

How to use

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

Demo via Streamlit

  1. streamlit run app/run.py