Skip to content
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

Allow save_model/load_model to accept a file-like object #19352

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

adriangb
Copy link
Contributor

I'm working on getting https://github.com/adriangb/scikeras and one of the needed features is being able to pickle models (e.g. for GridSearchCV). This is the first step for this, I can follow up with a PR to implement Model.__reduce__ although that is not strictly necessary (it can be implemented via copyreg.pickle in SciKeras).

Since saving already worked with a file-like object internally I just had to refactor the logic into _fileobj methods making this a pretty straightforward change.

Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. The code looks good.

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Mar 21, 2024
@fchollet fchollet merged commit 3255c9d into keras-team:master Mar 21, 2024
10 checks passed
@google-ml-butler google-ml-butler bot removed the ready to pull Ready to be merged into the codebase label Mar 21, 2024
@adriangb adriangb deleted the save-to-fileobj branch March 21, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

4 participants