-
Notifications
You must be signed in to change notification settings - Fork 442
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
Increase reuse of ModelConfig
#1954
Increase reuse of ModelConfig
#1954
Conversation
ModelConfig
ModelConfig
Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[email protected]>
Co-authored-by: Alex Strick van Linschoten <[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.
Nice, this feels much cleaner 🙌
Just have a few more minor suggestions, otherwise this looks good to merge 👍
@@ -515,7 +521,7 @@ def _print_artifacts_links_generic( | |||
help="List artifacts linked to a model version.", | |||
) | |||
@click.argument("model_name_or_id") | |||
@click.argument("model_version_name_or_number_or_id") | |||
@click.argument("model_version_name_or_number_or_id", default="0") |
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 feels a bit weird, why can't we use None
as default / latest value instead?
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.
Cause it is strings - cli arguments and -1
which I planned to use is treated as a parameter name, so 0 seemed a solid choice. Moreover - user will not specify it directly, it will be set by just skipping this arg.
zenml model version artifacts my_model
-> will return artifacts for latest in my_model
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 don't get it, why can't it be Optional[str]
instead? I.e., why would this not work?
@click.argument("model_name_or_id")
@click.argument("model_version_name_or_number_or_id")
def list_model_version_artifacts(
model_name_or_id: str,
model_version_name_or_number_or_id: Optional[str] = None,
) -> None:
...
def _print_artifacts_links_generic(
model_name_or_id: str,
model_version_name_or_number_or_id: Optional[str] = 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.
It is a click limitation, as I see this. If I set default=None
it is treated as no default, making arg mandatory. Changes on the level of functions args are not effective at all - @click.argument
is the king here.
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.
Ah, yes, click.argument
means mandatory, for optional inputs you need to use click.option
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.
Nah, the option would lead to the argument passing as --model_version_name_or_number_or_id
and not just zenml some_command some_argument [some_skipped_optional_argument]
or I completely misuse click 🙂
…instantiations-of-objects-in-model-co
…instantiations-of-objects-in-model-co
…instantiations-of-objects-in-model-co
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 great + lovely to have it well tested, too.
Describe changes
This PR removes
ModelConfigModel
; all codes now useModelConfig
instead.ModelConfig
now has amodel
andmodel_version
to avoid multiple calls to DB while working inside the same context.ModelConfig
is still instantiated on every step due to how reading of configs from DB works currently - it gets a dict and converts to_model where applicable, but no extra calls to DB are done with the current architecture.Pre-requisites
Please ensure you have done the following:
develop
and the open PR targetsdevelop
. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes