Skip to content

Commit

Permalink
Merge branch 'feature/better-metadata' of github.com:zenml-io/zenml i…
Browse files Browse the repository at this point in the history
…nto feature/better-metadata
  • Loading branch information
AlexejPenner committed Oct 21, 2024
2 parents 8f4af6e + 4b2434a commit cc6902b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/e2e/.copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 2024.10.10
_commit: 2024.10.21
_src_path: gh:zenml-io/template-e2e-batch
data_quality_checks: true
email: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion examples/e2e/steps/deployment/deployment_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def deployment_deploy() -> (
registry_model_name=model.name,
registry_model_version=model.run_metadata[
"model_registry_version"
].value,
],
replace_existing=True,
)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,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
6 changes: 3 additions & 3 deletions examples/e2e/steps/promotion/promote_with_metric_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ def promote_with_metric_compare(
# Promote in Model Registry
latest_version_model_registry_number = latest_version.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.run_metadata["model_registry_version"].value
current_version.run_metadata["model_registry_version"]
)
promote_in_model_registry(
latest_version=latest_version_model_registry_number,
Expand All @@ -111,7 +111,7 @@ def promote_with_metric_compare(
else:
promoted_version = current_version.run_metadata[
"model_registry_version"
].value
]

logger.info(
f"Current model version in `{target_env}` is `{promoted_version}` registered in Model Registry"
Expand Down
2 changes: 1 addition & 1 deletion examples/e2e_nlp/.copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 2024.09.23
_commit: 2024.10.21
_src_path: gh:zenml-io/template-nlp
accelerator: cpu
cloud_of_choice: aws
Expand Down
2 changes: 1 addition & 1 deletion examples/e2e_nlp/gradio/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pandas==1.5.3
session_info==1.0.0
scikit-learn==1.5.0
transformers==4.28.1
IPython==7.34.0
IPython==8.10.0
12 changes: 4 additions & 8 deletions examples/e2e_nlp/steps/promotion/promote_get_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def promote_get_metrics() -> (

# Get current model version metric in current run
model = get_step_context().model
current_metrics = (
model.get_model_artifact("model").run_metadata["metrics"].value
)
current_metrics = model.get_model_artifact("model").run_metadata["metrics"]
logger.info(f"Current model version metrics are {current_metrics}")

# Get latest saved model version metric in target environment
Expand All @@ -72,11 +70,9 @@ def promote_get_metrics() -> (
except KeyError:
latest_version = None
if latest_version:
latest_metrics = (
latest_version.get_model_artifact("model")
.run_metadata["metrics"]
.value
)
latest_metrics = latest_version.get_model_artifact(
"model"
).run_metadata["metrics"]
logger.info(f"Latest model version metrics are {latest_metrics}")
else:
logger.info("No currently promoted model version found.")
Expand Down

0 comments on commit cc6902b

Please sign in to comment.