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

How to save model ? #74

Open
mekazanc opened this issue Aug 29, 2023 · 2 comments
Open

How to save model ? #74

mekazanc opened this issue Aug 29, 2023 · 2 comments

Comments

@mekazanc
Copy link

Hello, I want to save this model as we do with traditional pickle method but it generates the following error.
Do you have any suggestion to save model object properly ?

AttributeError: Can't pickle local object 'LinearGaussianStateSpaceModel.__init__.<locals>._maybe_make_callable_from_linop.<locals>.<lambda>

@WillianFuks
Copy link
Owner

Hi @mekazanc ,

Oddly enough just now that you asked that I realized that we don't have indeed some approach for saving and reloading trained models.

Unfortunately for what I just tested here this (apparently) won't be a straightforward issue to solve. The trained model isn't serializable so there's no way of representing it in a binary file and hence the error.

I couldn't think of a good solution for you to use for now other than saving the class attributes of the object ci and then re-creating ci again (with simple data) and then re-writing everything manually.

This is incredibly ugly so it's not really a solution, it's just something that would work in case of desperation.

I'll leave this one open, if someone in the community also finds a good solution for that hopefully we get some insights. Other than that this would have to be fully supported internally by tfci (hopefully I can manage to find some time to implement that, it's arguably a good feature to have).

Hope this helps (a bit).

@mekazanc
Copy link
Author

mekazanc commented Sep 1, 2023

Thank you @WillianFuks for your clear answer. Yes, I already pulled required data points from the class attributes. I played with pickle-based saving but it did not work due to local object issues.

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

No branches or pull requests

2 participants