(issue #67) make early_stopping optional; cpu default device for trainer, evaluator - #68
Merged
ChrisNick92 merged 1 commit intoMay 8, 2026
Conversation
stefanos-vlachos
approved these changes
May 8, 2026
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.
Make Early Stopping Optional & Add
current_patienceto Trainer StateOverview
Early stopping is now opt-in rather than always active,
current_patienceis exposed ontrainer.statefor runtime introspection, and the default device forTrainerandEvaluatoris changed to"cpu"to avoid errors on machines without a GPU.Changes
Early Stopping — opt-in
patiencenow defaults toNone(previously15). WhenNone,EarlyStopperis not added to the callback list and training always runs for the full number of epochs.EarlyStopperis only instantiated whenpatienceis explicitly set.list[BaseCallback]to correctly accommodate bothCheckpointerandEarlyStopper.current_patienceonStateState.current_patience: int = 0added — updated byEarlyStopperafter each epoch, allowing callers to monitor patience consumption viatrainer.state.current_patience.Default device changed to
"cpu"Trainer,Evaluator, andget_devicenow default todevice="cpu". Previously defaulting to"cuda"caused an immediateValueErroron CPU-only machines before any training could start.get_deviceerror messages updated to suggest the correct alternative device.