-
Notifications
You must be signed in to change notification settings - Fork 55
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
Added save_format
to config.json
and hub_utils.init()
#242
Conversation
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.
looks good. you should also send a commit including the text [CI inference]
in the commit message to run the inference tests.
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.
Not much to add from my side on top of what Adrin wrote.
Co-authored-by: Adrin Jalali <[email protected]>
Co-authored-by: Adrin Jalali <[email protected]>
Co-authored-by: Adrin Jalali <[email protected]>
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.
Thanks @merveenoyan
We also need an entry in the changelog
skops/hub_utils/tests/test_hf_hub.py
Outdated
# 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") |
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.
add a comment to remove when #207 is merged.
skops/hub_utils/tests/test_hf_hub.py
Outdated
if file_format != "pickle": | ||
return |
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 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 |
docs/changes.rst
Outdated
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go to v0.4 section.
Co-authored-by: Adrin Jalali <[email protected]>
@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 🥲) |
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.
Otherwise LGTM
Co-authored-by: Adrin Jalali <[email protected]>
I'll let @BenjaminBossan have another look and merge. |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you suggest here @BenjaminBossan
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.
It's not a blocker, so feel free to merge.
Maybe something like:
Add
model_format
argument to :meth:skops.hub_utils.init
to be stored in
config.json
, which is used to determine the format of the model file
(pickle or skops).
skops/hub_utils/_hf_hub.py
Outdated
@@ -291,6 +318,9 @@ def init( | |||
:class:`numpy.ndarray`. If ``task`` is ``"text-classification"`` or | |||
``"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Co-authored-by: Benjamin Bossan <[email protected]>
Co-authored-by: Benjamin Bossan <[email protected]>
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a blocker, so feel free to merge.
Maybe something like:
Add
model_format
argument to :meth:skops.hub_utils.init
to 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