Open
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Save scores and baseline to .npy files after backward pass; skip backward on resume if files exist - Save validation progress incrementally; resume from last completed subset - DataStream: auto-pad batch_size to world_size multiple, expose real_examples_per_rank and padding metadata - Query stream: mask padded labels with ignore_index and apply correction factor after all-reduce for batch-invariant gradients - Training stream: keep divisibility requirement (padding changes loss via .mean() denominator) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
batch_size now means per-device; global batch = batch_size * world_size, which is always divisible by construction. This eliminates the need for padding, weight correction factors, label masking, and associated complexity in both DataStream and double_backward. Adds test_magic.py with: - Padding gradient invariance test (21 parametrized cases using real pythia-14m model, verified < 1e-5 in f64) - E2E magic CLI test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the dataset size isn't a multiple of global_batch_size, the last batch is padded: weight=0, labels=-100 for padded positions, and real positions in that batch are correction-scaled. DataStream.reset_weights() restores this state for the validation loop. Also adds test_final_batch_padding to verify the padding behavior. Co-Authored-By: Claude Opus 4.6 <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.
Uh oh!
There was an error while loading. Please reload this page.