Skip to content

vixhal-baraiya/microgpt-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicroGPT-C

The most atomic way to train and inference a GPT in pure, dependency-free C.

Compilation and Running

Compile with optimizations:

gcc -O3 -march=native -ffast-math -o microgpt microgpt.c -lm

Flags explained:

  • -O3: Maximum optimization
  • -march=native: Use CPU-specific instructions (AVX, etc.)
  • -ffast-math: Faster floating point (trades some precision)
  • -lm: Link math library (for sqrt, exp, etc.)

Run:

./microgpt

You should see loss decreasing, then generated samples!

About

The most atomic way to train and inference a GPT in pure, dependency-free C

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages