Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C implementation #11

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

gordicaleksa
Copy link
Contributor

@gordicaleksa gordicaleksa commented Jul 20, 2024

Added a C implementation following the style of llm.c's train_gpt2.c. I did deviate a bit where i thought I can do a potentially better job.

Tested for equivalency -> logits, loss, grads are all nearly == during the training.

PyTorch:
image

C:
image

NumPy (from PR #7):
image

See also #7.

@karpathy
Copy link
Contributor

I get Segmentation Fault :p I'll look into it in more detail!

@gordicaleksa
Copy link
Contributor Author

@karpathy no way! it doesn't happen on my side, you sure you're on HEAD commit? One of the intermediate commits had segfault issue (simple fix) but i don't think i was pushing that version, it was local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants