Skip to content

orvn/pi-jam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi JAM

Generative language models for inference on Raspberry Pi Zero. Just Another Model(s) for the smallest Rasberry Pi!


Models

Variant Type Weights Description
neuralpi (WIP) Decoder transformer ~25 MB 8-layer attention model, KV cache inference
jamxe 2-layer MLP 76 KB 512→512→45, dual-source feature hash with frozen query anchor
jamkid 2-layer MLP 76 KB Same engine as jamxe, trained on a kid-register dataset

jamxe and jamkid respond in milliseconds. neuralpi (work in progress) will be slower but architecturally more capable


Build

Requires gcc and make. No other dependencies for inference.

make

To cross-compile for Pi Zero (ARM1176)

CC=arm-linux-gnueabihf-gcc make

To build a single variant:

make -C neuralpi # decoder transformer
make -C jamxe    # extended MLP     (~76 KB weights)
make -C jamkid   # kid register     (~76 KB weights, same engine as jamxe)

Run

Each variant is a REPL: type a query, get a response

./jamxe/dist/jamxe jamxe/weights_xe.bin
./jamkid/dist/jamkid jamkid/weights_jamkid.bin
./neuralpi/dist/neuralpi neuralpi/weights_neuralpi.bin

When running on the Pi, the binary and weights file can sit in the same directory and the weights path can be omitted:

cd jamxe && ./dist/jamxe

Try

Variant Try
jamxe HOW ARE YOU, WHAT IS LOVE, 3+4, COUNT 5
jamkid HELLO, NAME, ORCA, STORY
neuralpi HOW ARE YOU, WHAT IS ATARI, TELL A STORY

Retrain

Training requires Python 3 and PyTorch (offline and independent from the Pi).

# MLP (jamxe / jamkid)
cd jamxe
python3 train_xe_strong.py td_xe.txt weights_xe.bin
make

# NeuralPi (transformer)
python3 train_transformer.py neuralpi/td_transformer.txt neuralpi/weights_neuralpi.bin
make -C neuralpi
# For large datasets (>10K pairs), augmentation auto-scales; override with --aug N if needed

Lineage

Lineage and naming of this repo comes from Atari JAM (Just Another Model), originally designed to run on an even tinier Atari 800.

About

A very smol language model for the Rasberry Pi Zero

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors