Calculate epoch timings#324
Merged
sgreenbury merged 9 commits intomainfrom Apr 16, 2026
Merged
Conversation
- Remove time-epochs and compute_cosine_epochs scripts - Integrate time-epochs functionality into CLI and commands
The timer previously measured only the training loop (on_train_epoch_start to on_train_epoch_end), excluding validation. This caused the time-epochs command to underestimate per-epoch duration and over-predict max_epochs, risking max_time cutting training short before the cosine schedule completes. Now measures from one on_train_epoch_start to the next (with the final epoch closed by on_train_end), capturing training batches, validation batches, and any inter-epoch overhead.
78922a9 to
9a87a02
Compare
Correct max_time output to DD:HH:MM:SS and add validation for budget, margin, and num_epochs. Update docs example to match.
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.
This pull request adds a new workflow command for timing training epochs and recommending
max_epochsfor cosine learning rate schedules, along with related documentation and support code. The main goal is to help users accurately settrainer.max_epochsso that the cosine schedule completes exactly within a given wall-clock budget, with a safety margin. The implementation includes both CLI and SLURM support, and provides detailed user guidance.The most important changes include:
New Feature: Epoch Timing and Schedule Recommendation
time-epochscommand to the CLI (src/autocast/scripts/workflow/cli.py,src/autocast/scripts/workflow/commands.py), which runs a short training job to measure per-epoch duration and computes the recommendedtrainer.max_epochsfor a cosine half-period schedule within a user-specified wall-clock budget. [1] [2] [3]Documentation
docs/SCRIPTS_AND_CONFIGS.mdexplaining how to use the new timing feature, including example commands, SLURM integration, margin selection, and the interaction betweenmax_epochsandmax_time.Training Script Support
TrainingTimerCallbackis always attached in autoencoder training so that per-epoch timing data is available in checkpoints.These changes make it easy and robust to calculate the correct number of epochs for cosine schedules, improving reproducibility and efficient use of compute budgets.