BlueGranite / BlogBot

BlueGranite Blogging Bot using the OpenAI GPT-2 Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlueGranite BlogBot

BlueGranite Blogging Bot using the OpenAI GPT-2 Model

BlueGranite, Inc.

Colby T. Ford and Thomas J. Weinandy

Purpose

To showcase the power and utility of generative AI models, specifically in technical writing. Also, we aim to show the inherent bias that comes with imbalanced training of such models.

This repository hosts the companion code our blog post: A BlueGranite Blog Post Written (Mostly) by AI

Getting Started

Navigate to the gpt-2 folder from the command line and run docker build command:

docker build --tag gpt-2 -f Dockerfile.cpu .

Once the image is finished being built, run the image:

docker run --name gpt-2 -d gpt-2

To get into the command line of the container, run:

docker exec -it gpt-2 /bin/bash

Copy the corpus of BlueGranite blogs to the container

docker cp ../scraper/BlueGranite_BlogBodies.txt gpt-2:./gpt-2/

Tune the existing GPT-2 model on the corpus of BlueGranite blogs

# PYTHONPATH=src ./train.py --dataset BlueGranite_BlogBodies.txt --model_name 124M
python ./train.py --dataset BlueGranite_BlogBodies.txt --model_name 124M

Have the model provide writing samples

# PYTHONPATH=src src/interactive_conditional_samples.py --model_name 124M --seed 1337 --nsamples 1 --top_k 40 --temperature 0.7
python src/interactive_conditional_samples.py --model_name 124M --seed 1337 --nsamples 1 --top_k 40 --temperature 0.7

Then, type the desired prompt into the command line.

Once you're finished, you can copy data from the container using:

docker cp gpt-2:./gpt-2/checkpoint ./checkpoint
docker cp gpt-2:./gpt-2/samples ./samples

Source

GPT-2 was created by OpenAI. Model tuning code was referenced from github.com/nshepperd/gpt-2

About

BlueGranite Blogging Bot using the OpenAI GPT-2 Model

License:MIT License


Languages

Language:Python 98.4%Language:R 1.6%