Skip to content

usyntest/nanogpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nanoGPT

This repository contains implementations of two language models:

  1. Bigram Language Model (bigram.py) – A simple neural network-based bigram model.
  2. Transformer-based GPT Model (gpt.py) – A more advanced language model using self-attention.

Features

  • Implements a basic bigram language model with embeddings.
  • Implements a Transformer-based language model inspired by GPT.
  • Uses PyTorch for model training and inference.
  • Includes text generation capabilities.

Installation

Ensure you have Python installed along with the required dependencies:

pip install torch numpy

Usage

Running the Bigram Model

python bigram.py

This will train a simple bigram model and generate text.

Running the GPT Model

python gpt.py

This will train and generate text using a Transformer-based model.

File Structure

  • bigram.py: Implements the Bigram Language Model.
  • gpt.py: Implements a Transformer-based GPT-style model.

About

A minimal, efficient implementation of GPT (Generative Pre-trained Transformer) using PyTorch, optimized for small-scale training and fine-tuning on custom datasets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages