Skip to content
nithinbharathiPublic

About

A lightweight, PyTorch-based custom GPT model trained to generate rap lyrics in the style of Eminem.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rapgpt

A tiny character-level decoder-only Transformer (no cross-attention) trained on Eminem songs using the kaggle dataset.

Features

  • Generate rap lyrics based on user specified token count
  • Configurable maximum number of generated tokens

Project Structure

backend/

  • train.py – trains the Transformer model
  • inference.py – loads the trained model and runs inference
  • model_weights.pth – pretrained model weights
  • main.py - starts the backend server and exposes the api

frontend/

  • React application

Requirements

  • Python 3.8 or newer
  • PyTorch
  • Fast API
  • Node.js
  • React

Usage

clone the repository:

git clone https://github.com/nithinbharathi/rapgpt.git
cd rapgpt

Run backend:

cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python main.py

Run frontend:

cd frontend
npm install
npm run dev

Pretrained Model

The repository already includes backend/model_weights.pth, so you can run the application immediately without training the model.

Training (Optional)

If you'd like to train the model yourself,

cd backend
python train.py

The trained model will be saved as

model_weights.pth

which is automatically loaded by the backend during inference.

Screenshots

alt

Figure 1: front end

alt

Figure 2: Model Loss over epochs

Note About Response Time

This application is deployed on a serverless platform. If the app has not received any requests for a while, the first request may take a little longer to process due to server initialization (cold start).

Subsequent requests will be significantly faster once the server is active.

If you experience a longer-than-usual wait on your first request, please wait a few seconds and try again — the application is warming up.

Acknowledgements

Inspired by Andrej Karpathy's nanoGPT and related educational resources.

About

A lightweight, PyTorch-based custom GPT model trained to generate rap lyrics in the style of Eminem.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages