Complete TinyInfiniTrain homework (EnzoDing-rgb) - #12
Open
EnzoDing-rgb wants to merge 2 commits into
Open
Conversation
Implement dispatcher Call/Register, Neg autograd, Matmul/Adam CPU+CUDA, Tensor Flatten/Backward, Shakespeare dataset and tokenizer; replace std::format with JoinDot for g++11 compatibility. Co-authored-by: Cursor <cursoragent@cursor.com>
…tics) The dataset previously used stride-1 overlapping windows (sample idx offset by one token), so every training batch saw tokens[idx : idx+seq_len]. Tiny Shakespeare data is produced by karpathy/llm.c's tinyshakespeare.py, which uses non-overlapping windows: sample idx covers tokens[idx*seq_len : (idx+1)*seq_len]. This made the GPT-2 training data differ from the reference run that generated gpt2_logits_reference.bin, so LogitsConsistency failed by a large margin (logits off by 10-270). With the correct windowing the test passes on CUDA within the 1e-3 tolerance. - num_samples = num_toks / sequence_length (was num_toks - sequence_length) - sequence_size_in_bytes_ = sequence_length * sizeof(int64_t) (was sizeof(int64_t)) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
std::formatwithJoinDotfor g++11 compatibility.Test plan
test_dispatcher/test_elementwise/test_matmul/test_matmul_cuda/test_adam/test_adam_cuda/test_tensortest_gpt2LogitsConsistencyMade with Cursor