fix: Make training budget validation idempotent. - #52
Merged
Merged
Conversation
Neonkraft
approved these changes
Aug 26, 2026
| if t.max_steps is not None: | ||
| return t.max_steps | ||
| if t.num_training_samples is not None: | ||
| return math.ceil(t.num_training_samples / t.effective_batch_size) |
Collaborator
There was a problem hiding this comment.
Unrelated to this PR, but I wonder how this will hold up when packing is enabled.
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
The current training budget validation resolves all budget options, except #epochs, to
max_steps, which gets saved in the freezed config, along with the original budget option (e.g.,num_training_tokens). Thus, in the frozen config, there is more than 1 budget option set, making the actual training validation fail.This fixes the issue by avoiding writing
max_stepsto the freezed config file. Then, the number of max steps is resolved wherever needed using a helper method in the configuration object.Type of change
Validation
PYTHONPATH=src uv run pytest tests/test_data_loader.pyPYTHONPATH=src uv run pre-commit run --all-files