MIT License

项目介绍

vixhal-baraiya/microgpt-c 是一个托管在 GitHub 上的开源项目,主要使用 C 编写,采用 MIT License 许可证,目前获得 848 个 Star、111 次 Fork。

仓库全名
vixhal-baraiya/microgpt-c
开源许可证
MIT License
Star 数
848
Fork 数
111
未关闭 Issue
2

README 摘要

microGPT-C The most atomic way to train and inference a GPT in pure, dependency-free C. A character-level transformer with forward pass, backprop, Adam and sampling, in one C file with nothing beyond libc. It trains on 32k names in a couple of seconds and generates new ones. Build and run Or run it directly, on any corpus with one item per line: Builds on macOS, Linux and Windows (MSYS2), on ARM64 with NEON and…

完整内容见 GitHub 原始 README 或本页 。

常见问题

microgpt-c 用什么语言开发?

主要使用 C 编写,采用 MIT License 许可证,目前有 848 个 Star。

microgpt-c 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 microgpt-c 的源码?

可以直接克隆仓库:git clone https://github.com/vixhal-baraiya/microgpt-c.git,默认分支为 main;安装与运行步骤见仓库 README。

microgpt-c 最近还在维护吗?

仓库最近一次更新为 8月17日,当前有 2 个未关闭 Issue;Star 数为 848,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

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

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
1077
价值分
542
活跃状态
活跃

语言占比

C

README

microGPT-C

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

A character-level transformer with forward pass, backprop, Adam and sampling, in one C file with nothing beyond libc. It trains on ~32k names in a couple of seconds and generates new ones.

Build and run

make run

Or run it directly, on any corpus with one item per line:

./microgpt data/names.txt

Builds on macOS, Linux and Windows (MSYS2), on ARM64 with NEON and x86-64 with AVX2. The Makefile picks the flags for the host.

step 5000 / 20000 | loss 2.6036  (avg 2.2940)
step 10000 / 20000 | loss 1.9639  (avg 2.2564)
step 15000 / 20000 | loss 2.7007  (avg 2.2151)
step 20000 / 20000 | loss 2.3463  (avg 2.2201)

inference
sample  1: kayley
sample  2: maria
sample  3: arana
sample  4: shayan
sample  5: jayden
sample  6: saria
sample  7: kaylen
sample  8: amari
sample  9: alina
sample 10: mailyn
  c fp32+NEON       10168430 tok/sec

Notes

The model has 4192 parameters and generalises rather than memorises. Trained on 20000 of the 32033 names, it scores 2.2054 nats per character on those and 2.2039 on the 12033 it never saw, beating an interpolated trigram that has nearly five times as many parameters.

Training and inference use separate forward passes. gpt_forward stores activations for backprop; gpt_forward_infer is a specialised single-token path whose logits match it to within fp32 rounding. docs/PERFORMANCE.md covers how that path works and what limits it.

machine backend tok/sec
Apple M5 Pro NEON 10,168,430
AMD Ryzen 5 5600H AVX2 6,927,775

评论

暂无评论