Skip to content

Commit

Permalink
Removing the deprecated log_xxx_metadata calls (#48)
Browse files Browse the repository at this point in the history
* removing deprecated metadata calls

* fixing the call
  • Loading branch information
bcdurak authored Dec 2, 2024
1 parent f67756a commit 12dde3e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ jobs:
with:
stack-name: ${{ matrix.stack-name }}
python-version: ${{ matrix.python-version }}
ref-zenml: ${{ inputs.ref-zenml || 'develop' }}
ref-zenml: ${{ inputs.ref-zenml || 'feature/followup-run-metadata' }}
ref-template: ${{ inputs.ref-template || github.ref }}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ To create parallel processing of computationally expensive operations we use a l
<summary>Code snippet 💻</summary>

```python
from zenml import log_artifact_metadata
from zenml import log_metadata
score = accuracy_score(y_tst, y_pred)
# log score along with output artifact as metadata
log_artifact_metadata(
output_name="hp_result",
metric=float(score),
log_metadata(
metadata={"metric": float(score)},
artifact_name="hp_result",
)
```
</details>
Expand Down
2 changes: 1 addition & 1 deletion template/steps/training/model_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import mlflow
import pandas as pd
from sklearn.base import ClassifierMixin
from zenml import ArtifactConfig, log_artifact_metadata, step, get_step_context
from zenml import ArtifactConfig, step, get_step_context
from zenml.client import Client
from zenml.integrations.mlflow.experiment_trackers import MLFlowExperimentTracker
from zenml.integrations.mlflow.steps.mlflow_registry import mlflow_register_model_step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sklearn.metrics import accuracy_score
from sklearn.model_selection import RandomizedSearchCV
from utils import get_model_from_config
from zenml import log_artifact_metadata, step
from zenml import log_metadata, step
from zenml.logger import get_logger

logger = get_logger(__name__)
Expand Down Expand Up @@ -79,9 +79,10 @@ def hp_tuning_single_search(
y_pred = cv.predict(X_tst)
score = accuracy_score(y_tst, y_pred)
# log score along with output artifact as metadata
log_artifact_metadata(
log_metadata(
metadata={"metric": float(score)},
artifact_name="hp_result",
infer_artifact=True,
)
### YOUR CODE ENDS HERE ###
return cv.best_estimator_

0 comments on commit 12dde3e

Please sign in to comment.