Skip to content

cthiriet/femtoGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

femtoGPT

GPT implementation in pure Python.

You've seen nanoGPT.

You've seen picoGPT.

Now, imagine you're alone on a desert island 🏝️ with a computer, Python installed and no Internet (you can't do pip install torch 🥲).

A crazy idea occurs to you: what if I created a GPT model... from scratch?

Here is the result of this work: femtoGPT, a GPT implementation in pure Python, without any dependencies... and with it's own autograd engine (inspired by micrograd).

Features

  • No tensor ❌
  • Not fast ❌
  • No batch (one sample at a time) ❌
  • No GPU support ❌

A pure learning experience.

Enjoy!

Usage

Install the package:

git clone https://github.com/cthiriet/femtoGPT
pip install .

Train a femto GPT model on a dataset, that is actually...just a string:

# Train on the "hello world" sentence
python femtogpt/train.py --dataset "hello world"

Tests

pytest

About

a GPT in pure Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages