Replies: 3 comments 1 reply
-
Hi @JnsLns |
Beta Was this translation helpful? Give feedback.
-
You can subclass and override specific methods if you would like. Including those dealing with save and load. You don't need to override the init for a subclass. The way save and load works at the moment requires parameters or you'll run into that ValueError |
Beta Was this translation helpful? Give feedback.
-
Hi again @wd60622 ! Thanks for the hint, I am aware that I can override everything and thereby definitely can make it work somehow. My post was supposed to be less of a question rather than a suggestion. The point i wanted to make was simply that the existing save/load mechanic makes it impossible (and I feel needlessly so) to conveniently override (Not directly related to #1218) |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am using a simple custom subclass of MMM, for which I have to execute just a bit of additional code in
__init__
, boiling down to this:I noticed that this disupts the save/load functionality, because the
set_idata_attrs
method called at the end offit()
crashes with a value error:ValueError: __init__ has parameters that are not in the attrs: {'args', 'kwargs'}. The save and load functionality will not work correctly.
This ultimately stems from comparing the signature of__init__
to the expected set of attributes, which does not includeargs
andkwargs
.The thing is, everything works up to the final portion of fit, expect for the idata attributes being set. Hence they cannot be reinstated at model load time later.
Yet, I think all that stands in the way for this to work is the Value Error that prevents the final line of
ModelBuilder.set_idata_attrs
from being executed:idata.attrs = attrs
. So one solution may be to make this Value Error a warning instead.Edit: Using version 0.10.0
Beta Was this translation helpful? Give feedback.
All reactions