Added save_format to config.json and hub_utils.init()#242
Added save_format to config.json and hub_utils.init()#242BenjaminBossan merged 18 commits intoskops-dev:mainfrom
save_format to config.json and hub_utils.init()#242Conversation
adrinjalali
left a comment
There was a problem hiding this comment.
looks good. you should also send a commit including the text [CI inference] in the commit message to run the inference tests.
BenjaminBossan
left a comment
There was a problem hiding this comment.
Not much to add from my side on top of what Adrin wrote.
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
adrinjalali
left a comment
There was a problem hiding this comment.
Thanks @merveenoyan
We also need an entry in the changelog
| # a model card is needed for inference engine to work. | ||
| model_card = card.Card( | ||
| model, metadata=card.metadata_from_config(Path(destination_path)) | ||
| ) | ||
| model_card.save(Path(destination_path) / "README.md") |
| if file_format != "pickle": | ||
| return |
There was a problem hiding this comment.
I think instead of silently skipping the inference test, we should parameterize and only test for pickle, and when inference API starts working with .skops, we add it here.
|
there was a problem with fixture |
| - Add `model_format` argument to :meth:`skops.hub_utils.init` to write it | ||
| as a section to `config.json`. :pr:`242`by `Merve Noyan`_. |
There was a problem hiding this comment.
this should go to v0.4 section.
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
|
@adrinjalali I don't know I could swear adding it to v0.4 🥲🥲🥲 addressed both |
|
@adrinjalali ran black, apparently previous pre-commit didn't catch something (I looked at my CLI and it was all passed 🥲) |
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
|
I'll let @BenjaminBossan have another look and merge. |
BenjaminBossan
left a comment
There was a problem hiding this comment.
Implementation-wise, this looks good to me.
I have a small issue with the wording, please take a look if my concern is valid. Apart from that, I suggested a empty lines in the docstring for consistency.
| - Add `model_format` argument to :meth:`skops.hub_utils.init` to be stored in | ||
| `config.json` so that we know how to load a model from the repository. | ||
| :pr:`242` by `Merve Noyan`_. |
There was a problem hiding this comment.
If I didn't already know, I would be confused about what this new feature does. Maybe we should avoid the word "we" in the changes.rst and instead use more neutral language.
There was a problem hiding this comment.
It's not a blocker, so feel free to merge.
Maybe something like:
Add
model_formatargument to :meth:skops.hub_utils.initto be stored in
config.json, which is used to determine the format of the model file
(pickle or skops).
| ``"text-regression"``, the data needs to be a ``list`` of strings. | ||
|
|
||
| model_format: str | ||
| The format used to persist the model. Can be ``"auto"``, ``"skops"`` |
There was a problem hiding this comment.
Maybe it's just me, but when I read this docstring, it could also mean "the model format that is being used [by this function] to persist the model", when what it really means is "the model format that was used to persist the model [by the user]". The former interpretation could lead the user to believe that init will create a new model file using that format. E.g. when I have a pickle file and I use model_format="skops", then init will create a skops file from the pickle file for me.
Something like "The format used by the persisted model" could help to disambiguate the two meanings. WDYT?
The same ambiguity can be found in the docstring of _create_config but there it's less important, as it's internal.
|
@adrinjalali I accidentally asked for review 🥲 |
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com>
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com>
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com>
BenjaminBossan
left a comment
There was a problem hiding this comment.
LGTM, thanks. Last point is no blocker for merging.
| - Add `model_format` argument to :meth:`skops.hub_utils.init` to be stored in | ||
| `config.json` so that we know how to load a model from the repository. | ||
| :pr:`242` by `Merve Noyan`_. |
There was a problem hiding this comment.
It's not a blocker, so feel free to merge.
Maybe something like:
Add
model_formatargument to :meth:skops.hub_utils.initto be stored in
config.json, which is used to determine the format of the model file
(pickle or skops).
Big chunk of work is to refactor tests. TIL you could add parametrization to fixtures
This is a draft PR, feel free to skim through it but don't look for nits