Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive model persistence capabilities to deep-river, enabling users to save and load trained models to/from disk. The implementation includes save/load methods for all estimator types, utility functions for model inspection, and comprehensive documentation through examples.
- Adds
save()andload()methods to all estimator base classes (DeepEstimator, DeepEstimatorInitialized, and their rolling variants) - Implements utility functions for model persistence including serialization of PyTorch state, optimizer state, metadata, and configuration
- Provides comprehensive testing coverage through new unit test checks that validate persistence functionality
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/examples/model_persistence/model_persistence_demo.ipynb | Complete Jupyter notebook demonstrating model persistence with training, saving, and loading examples |
| docs/examples/model_persistence/README.md | Documentation explaining the persistence examples and key features |
| docs/examples/model_persistence/.pages | Configuration file for documentation structure |
| deep_river/utils/estimator_checks.py | Adds comprehensive unit tests for model persistence functionality including save/load validation and error handling |
| deep_river/base.py | Core implementation of save/load methods and persistence utilities with support for all estimator types |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
deep_river/base.py
Outdated
| save_data: Dict[str, Any] = { | ||
| "estimator_type": estimator_type, | ||
| "estimator_class": estimator_class, | ||
| "deep_river_version": "0.3.0", # Current version |
There was a problem hiding this comment.
The version is hardcoded as a string literal. Consider importing this from a version module or package metadata to ensure it stays synchronized with the actual package version.
deep_river/utils/estimator_checks.py
Outdated
| return | ||
|
|
||
| # Test get_model_info functionality | ||
| from deep_river.base import get_model_info |
There was a problem hiding this comment.
This import is placed inside a function, which can impact performance if the function is called frequently. Consider moving this to the top-level imports section.
deep_river/utils/estimator_checks.py
Outdated
|
|
||
| def check_model_persistence_error_handling(model): | ||
| """Test error handling for persistence operations.""" | ||
| from deep_river.base import get_model_info, load_model |
There was a problem hiding this comment.
This import is placed inside a function, which can impact performance if the function is called frequently. Consider moving this to the top-level imports section.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.