Text Generator is an End-to-End NLP model which can generate text based on given input deployed on Streamlit
Model : GPT-2
Library : 🤗 Hugging Face
Pre-Trained on : English language using a causal language modeling (CLM)
- Just open above link and select Text Generator
- Clone the project
git clone https://github.com/srajanseth84/Text-Generator-using-GPT2.git- Go to the project directory
cd Text-Generator-using-GPT2- Create venv
python3 -m virtualenv venv - Activate the venv
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Start the server
streamlit run app.py -
GPT-2 is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.
-
More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens.
-
This way, the model learns an inner representation of the English language that can then be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a prompt.
- Front-End: Streamlit
- Cloud: Streamlit Cloud
- DL-Framework: Hugging Face
