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

Added save_format to config.json and hub_utils.init() #242

Merged
merged 18 commits into from
Dec 13, 2022

Conversation

merveenoyan
Copy link
Collaborator

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

Copy link
Member

@adrinjalali adrinjalali left a 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.

Copy link
Collaborator

@BenjaminBossan BenjaminBossan left a 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.

Copy link
Member

@adrinjalali adrinjalali left a 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

Comment on lines 475 to 479
# 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")
Copy link
Member

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.

Comment on lines 454 to 455
if file_format != "pickle":
return
Copy link
Member

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.

@merveenoyan
Copy link
Collaborator Author

there was a problem with fixture temp_path with python 3.7 so I swapped it with mkdtemp instead.

docs/changes.rst Outdated
Comment on lines 54 to 55
- Add `model_format` argument to :meth:`skops.hub_utils.init` to write it
as a section to `config.json`. :pr:`242`by `Merve Noyan`_.
Copy link
Member

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.

@merveenoyan
Copy link
Collaborator Author

@adrinjalali I don't know I could swear adding it to v0.4 🥲🥲🥲 addressed both

@merveenoyan
Copy link
Collaborator Author

@adrinjalali ran black, apparently previous pre-commit didn't catch something (I looked at my CLI and it was all passed 🥲)

Copy link
Member

@adrinjalali adrinjalali left a 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]>
@adrinjalali
Copy link
Member

I'll let @BenjaminBossan have another look and merge.

Copy link
Collaborator

@BenjaminBossan BenjaminBossan left a 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.

Comment on lines +19 to +21
- 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`_.
Copy link
Collaborator

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.

Copy link
Member

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

Copy link
Collaborator

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).

@@ -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"``
Copy link
Collaborator

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.

@merveenoyan
Copy link
Collaborator Author

@adrinjalali I accidentally asked for review 🥲

merveenoyan and others added 3 commits December 12, 2022 18:09
Copy link
Collaborator

@BenjaminBossan BenjaminBossan left a 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.

Comment on lines +19 to +21
- 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`_.
Copy link
Collaborator

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).

@BenjaminBossan BenjaminBossan merged commit 7ebf893 into skops-dev:main Dec 13, 2022
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

Successfully merging this pull request may close these issues.

3 participants