Add train-only runner and latest checkpoint tracking#2058
Open
bkmi wants to merge 1 commit into
Open
Conversation
Introduce a TrainRunner core primitive backed by TorchTNT train(), while sharing checkpoint and callback wiring with TrainEvalRunner. Update TrainCheckpointCallback to maintain a latest symlink, validate checkpoint retention, and cover train-only runner/checkpoint behavior in tests.
44a8f90 to
8e78510
Compare
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
Adds a train-only runner primitive and tightens checkpoint handling after the callback refactor.
Changes:
TrainRunner, a core runner backed by TorchTNTtrain()._BaseTrainRunnersoTrainRunnerandTrainEvalRunnershare:TrainEvalRunneras the TorchTNTfit()runner and preserve its existingtrain_eval_unitinterface for compatibility.TrainCheckpointCallbackto:latestsymlink for step and final checkpoints,latest,max_saved_checkpoints >= 1,load_callbackstate.WandBSingletonLogger.init_wandb.Why
Some workflows need train-only execution without eval dataloaders or validation/test loss computation. This adds that capability as a fairchem core primitive instead of keeping it model-local, while preserving the existing train/eval runner behavior.
The latest-checkpoint symlink also gives downstream jobs and operators a stable checkpoint path while still retaining bounded checkpoint history.
Testing
Ran locally:
pytest tests/core/units/mlip_unit/test_train_eval_runner.py -q --rootdir . pre-commit run --files \ src/fairchem/core/components/train/train_runner.py \ src/fairchem/core/components/train/callbacks.py \ tests/core/units/mlip_unit/test_train_eval_runner.py python -m ruff check \ src/fairchem/core/components/train/train_runner.py \ src/fairchem/core/components/train/callbacks.py \ tests/core/units/mlip_unit/test_train_eval_runner.py \ --select F401,F841,F821,ARG