-
Notifications
You must be signed in to change notification settings - Fork 18
Refactor metadata #126
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
Refactor metadata #126
Conversation
machow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some questions about the .pkg attribute. Let's spend some of our pairing time today going over how metadata is being created <-> stored!
|
One last high-level thought: I just realized you could stash the model inside a dictionary (like R vetiver does). joblib should be able to serialize / deserialize a dictionary where one field is a model. (But also this way of handling the metadata seems totally reasonable!). |
This would make sense if I wanted to mimic R and move rstudio/vetiver-r#116 is related to this. |
|
Thanks -- that's helpful context around why you have done it this way! |
machow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is shaping up--thanks for being patient with all the metadata comments 😵💫. I left some note along two themes:
- can we move any metadata logic (including dealing with metadata dictionaries) into VetiverMeta? Can VetiverModel ensure its
metadataattr is a VetiverMeta (and add a type hint)? - the
pkglogic right now is a bit tricky, since a parent class expects it, but a child class might define it as a class attribute. It might be helpful to move this piece into a separate PR to get the metadata stuff in.
| meta = _model_meta(user, version, url, required_pkgs) | ||
|
|
||
| return meta | ||
| pip_name = self.pip_name if hasattr(self, "pip_name") else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to handle the pkg weirdness, the pkg attribute was removed. if there is a pip name, it will be handled as expected, otherwise it will set to None.
4e7e259 to
982251e
Compare
create_metato live solely inBaseHandler, rather than in each handler. This also removed the need fordescribein each handler.vetiver_metainside the metadata, which is not loaded on VetiverModel creation, fixing the bug whereuserdata is duplicated. On the R side, a list is pinned with metadata, rather than the model being pinned, and loading the metadata.required_pkgsonVetiverModelcreation