Skip to content

add persistency to Estimators#122

Merged
kulbachcedric merged 14 commits intomasterfrom
add_persistance
Sep 24, 2025
Merged

add persistency to Estimators#122
kulbachcedric merged 14 commits intomasterfrom
add_persistance

Conversation

@kulbachcedric
Copy link
Collaborator

No description provided.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

This comment was marked as outdated.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and load() 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

save_data: Dict[str, Any] = {
"estimator_type": estimator_type,
"estimator_class": estimator_class,
"deep_river_version": "0.3.0", # Current version
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
return

# Test get_model_info functionality
from deep_river.base import get_model_info
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

def check_model_persistence_error_handling(model):
"""Test error handling for persistence operations."""
from deep_river.base import get_model_info, load_model
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

kulbachcedric and others added 2 commits September 24, 2025 18:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kulbachcedric kulbachcedric merged commit 9c7ca16 into master Sep 24, 2025
18 checks passed
@kulbachcedric kulbachcedric deleted the add_persistance branch September 24, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants