Refactor training loop from script to class#65
Closed
sweep-nightly[bot] wants to merge 3 commits intomainfrom
Closed
Refactor training loop from script to class#65sweep-nightly[bot] wants to merge 3 commits intomainfrom
sweep-nightly[bot] wants to merge 3 commits intomainfrom
Conversation
Author
Rollback Files For Sweep
|
Author
Apply Sweep Rules to your PR?
|
4 tasks
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.
Description
This PR refactors the training loop from a script to a class for better organization and reusability. The training loop code was originally located in the
src/main.pyfile and has been moved into a new class namedMNISTTrainer. Thesrc/api.pyfile has also been updated to import and use the new class for prediction.Summary of Changes
MNISTTrainerinsrc/main.pyto encapsulate the training loop functionality.load_datain theMNISTTrainerclass.define_modelin theMNISTTrainerclass.Netclass insrc/main.pyto accept atrainloaderparameter in its constructor and use it for training the model.src/main.pyto create an instance ofMNISTTrainer, call its methods to load the data and define the model, and then pass the loaded data to theNetclass for training.src/api.pyto import theMNISTTrainerclass instead of theNetclass.src/api.pyto create an instance ofMNISTTrainer, call its methods to load the data and define the model, and then load the model's state from the saved file.README.mdto reflect the changes in the codebase, specifically explaining the newMNISTTrainerclass and how it is used insrc/main.pyandsrc/api.py.Fixes #6.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: