Skip to content

Commit

Permalink
Adjust to zenml-io/zenml#3096 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexejPenner authored Nov 7, 2024
1 parent 5b9b03a commit 01ed27f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,4 @@ cython_debug/
.local/
.ruff_cache/
.DS_Store
.idea
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ for step_name in step_names:
)
model: ClassifierMixin = hp_output.load()
# fetch metadata we attached earlier
metric = float(hp_output.run_metadata["metric"].value)
metric = float(hp_output.run_metadata["metric"])
if best_model is None or best_metric < metric:
best_model = model
```
Expand Down
2 changes: 1 addition & 1 deletion template/steps/deployment/deployment_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def deployment_deploy() -> (
# deploy predictor service
deployment_service = mlflow_model_registry_deployer_step.entrypoint(
registry_model_name=model.name,
registry_model_version=model.run_metadata["model_registry_version"].value,
registry_model_version=model.run_metadata["model_registry_version"],
replace_existing=True,
)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ def promote_with_metric_compare(
logger.info(f"Current model version was promoted to '{target_env}'.")

# Promote in Model Registry
latest_version_model_registry_number = latest_version.run_metadata["model_registry_version"].value
latest_version_model_registry_number = latest_version.run_metadata["model_registry_version"]
if current_version_number is None:
current_version_model_registry_number = latest_version_model_registry_number
else:
current_version_model_registry_number = current_version.run_metadata["model_registry_version"].value
current_version_model_registry_number = current_version.run_metadata["model_registry_version"]
promote_in_model_registry(
latest_version=latest_version_model_registry_number,
current_version=current_version_model_registry_number,
Expand All @@ -90,7 +90,7 @@ def promote_with_metric_compare(
)
promoted_version = latest_version_model_registry_number
else:
promoted_version = current_version.run_metadata["model_registry_version"].value
promoted_version = current_version.run_metadata["model_registry_version"]

logger.info(
f"Current model version in `{target_env}` is `{promoted_version}` registered in Model Registry"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def promote_latest_version(
logger.info(f"Current model version was promoted to '{target_env}'.")

# Promote in Model Registry
latest_version_model_registry_number = latest_version.run_metadata["model_registry_version"].value
latest_version_model_registry_number = latest_version.run_metadata["model_registry_version"]
if current_version.number is None:
current_version_model_registry_number = latest_version_model_registry_number
else:
current_version_model_registry_number = current_version.run_metadata["model_registry_version"].value
current_version_model_registry_number = current_version.run_metadata["model_registry_version"]
promote_in_model_registry(
latest_version=latest_version_model_registry_number,
current_version=current_version_model_registry_number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def hp_tuning_select_best_model(
hp_output = model.get_data_artifact("hp_result")
model_: ClassifierMixin = hp_output.load()
# fetch metadata we attached earlier
metric = float(hp_output.run_metadata["metric"].value)
metric = float(hp_output.run_metadata["metric"])
if best_model is None or best_metric < metric:
best_model = model_
### YOUR CODE ENDS HERE ###
Expand Down

0 comments on commit 01ed27f

Please sign in to comment.