add optional checkpoint saving to Trainer Class #50
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.
Description
Adds optional checkpoint saving functionality to the
Trainerclass, enabling users to save model state during training without modifying existing behavior.This fixes issue #48
Changes Made
Added checkpoint parameters to
Trainer.__init__():checkpoint_dir: Directory for saving checkpointscheckpoint_epochs: When to save(int for intervals, list for specific epochs)checkpoint_name: Base filename for checkpointssave_best: Whether to track and save best modelAdded private helper methods:
_should_save_checkpoint(): Determines when to save based setup_save_checkpoint(): Handles checkpoint file creationAdded public method:
load_checkpoint: Restores model and optimizer state from checkpointIntegrated checkpoint logic into 'fit()' method.
Usage
Basic Usage - Save Every 10 Epochs
Track Best Model