diff --git a/README.md b/README.md index 55542f9..16d0250 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ for step_name in step_names: ) model: ClassifierMixin = hp_output.load() # fetch metadata we attached earlier - metric = float(hp_output.metadata["metric"].value) + metric = float(hp_output.run_metadata["metric"].value) if best_model is None or best_metric < metric: best_model = model ``` diff --git a/template/steps/deployment/deployment_deploy.py b/template/steps/deployment/deployment_deploy.py index c66c002..d157363 100644 --- a/template/steps/deployment/deployment_deploy.py +++ b/template/steps/deployment/deployment_deploy.py @@ -50,7 +50,7 @@ def deployment_deploy() -> ( deployment_service = mlflow_model_registry_deployer_step.entrypoint( registry_model_name=model_version.name, registry_model_version=model_version.get_model_artifact("model") - .metadata["model_registry_version"] + .run_metadata["model_registry_version"] .value, replace_existing=True, ) diff --git a/template/steps/promotion/{% if metric_compare_promotion %}promote_with_metric_compare.py{% endif %} b/template/steps/promotion/{% if metric_compare_promotion %}promote_with_metric_compare.py{% endif %} index 90fb269..7c6ac3d 100644 --- a/template/steps/promotion/{% if metric_compare_promotion %}promote_with_metric_compare.py{% endif %} +++ b/template/steps/promotion/{% if metric_compare_promotion %}promote_with_metric_compare.py{% endif %} @@ -74,11 +74,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.get_model_artifact("model").metadata["model_registry_version"].value + latest_version_model_registry_number = latest_version.get_model_artifact("model").run_metadata["model_registry_version"].value if current_version_number is None: current_version_model_registry_number = latest_version_model_registry_number else: - current_version_model_registry_number = current_version.get_model_artifact("model").metadata["model_registry_version"].value + current_version_model_registry_number = current_version.get_model_artifact("model").run_metadata["model_registry_version"].value promote_in_model_registry( latest_version=latest_version_model_registry_number, current_version=current_version_model_registry_number, @@ -87,7 +87,7 @@ def promote_with_metric_compare( ) promoted_version = latest_version_model_registry_number else: - promoted_version = current_version.get_model_artifact("model").metadata["model_registry_version"].value + promoted_version = current_version.get_model_artifact("model").run_metadata["model_registry_version"].value logger.info( f"Current model version in `{target_env}` is `{promoted_version}` registered in Model Registry" diff --git a/template/steps/promotion/{% if not metric_compare_promotion %}promote_latest_version.py{% endif %} b/template/steps/promotion/{% if not metric_compare_promotion %}promote_latest_version.py{% endif %} index 0cad25d..776c6eb 100644 --- a/template/steps/promotion/{% if not metric_compare_promotion %}promote_latest_version.py{% endif %} +++ b/template/steps/promotion/{% if not metric_compare_promotion %}promote_latest_version.py{% endif %} @@ -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.get_model_artifact("model").metadata["model_registry_version"].value + latest_version_model_registry_number = latest_version.get_model_artifact("model").run_metadata["model_registry_version"].value if current_version.number is None: current_version_model_registry_number = latest_version_model_registry_number else: - current_version_model_registry_number = current_version.get_model_artifact("model").metadata["model_registry_version"].value + current_version_model_registry_number = current_version.get_model_artifact("model").run_metadata["model_registry_version"].value promote_in_model_registry( latest_version=latest_version_model_registry_number, current_version=current_version_model_registry_number, diff --git a/template/steps/{% if hyperparameters_tuning %}hp_tuning{% endif %}/hp_tuning_select_best_model.py b/template/steps/{% if hyperparameters_tuning %}hp_tuning{% endif %}/hp_tuning_select_best_model.py index a5d5b72..c306ce0 100644 --- a/template/steps/{% if hyperparameters_tuning %}hp_tuning{% endif %}/hp_tuning_select_best_model.py +++ b/template/steps/{% if hyperparameters_tuning %}hp_tuning{% endif %}/hp_tuning_select_best_model.py @@ -36,7 +36,7 @@ def hp_tuning_select_best_model( ) model: ClassifierMixin = hp_output.load() # fetch metadata we attached earlier - metric = float(hp_output.metadata["metric"].value) + metric = float(hp_output.run_metadata["metric"].value) if best_model is None or best_metric < metric: best_model = model ### YOUR CODE ENDS HERE ###