-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor hopper training loop and model loading #66
Conversation
Simplify the hopper training loop by removing commented out code and unnecessary print statements. Also, refactor the model loading process to handle cases where no saved model is found. This improves the readability and maintainability of the code.
Reviewer's Guide by SourceryThe changes uncomment and restore the training loop functionality in the hopper.py file, which includes model loading and training phases. The code now properly handles model loading with error cases and implements the training phase loop that was previously commented out. Sequence diagram for the hopper training loopsequenceDiagram
actor User
participant Hopper as Hopper Training
participant Model as Model Loader
User->>Hopper: Start Training
Hopper->>Model: Load Model
alt Model Found
Model-->>Hopper: Load Successful
Hopper->>Hopper: Update global_best_reward
else No Model Found
Model-->>Hopper: Error
Hopper->>Hopper: Start with Untrained Agent
end
Hopper->>Hopper: Train Agent
alt Training Successful
Hopper-->>User: Reached Solution Threshold
else Training Unsuccessful
Hopper->>Hopper: Continue Training
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @leonvanbokhorst - I've reviewed your changes - here's some feedback:
Overall Comments:
- The commit message doesn't accurately reflect the changes. Consider updating it to something like 'Enable hopper training loop' since the main change is uncommenting and activating the existing training code rather than refactoring it.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
# # Pass global best reward to train | ||
# success = ai.train(num_episodes=100, previous_best=global_best_reward) | ||
# Pass global best reward to train | ||
success = ai.train(num_episodes=100, previous_best=global_best_reward) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (code-quality): Use named expression to simplify assignment and conditional (use-named-expression
)
Simplify the hopper training loop by removing commented out code and unnecessary print statements. Also, refactor the model loading process to handle cases where no saved model is found. This improves the readability and maintainability of the code.
Summary by Sourcery
Enhancements: