feat: MLflow Apps for experiment tracking#102
feat: MLflow Apps for experiment tracking#102Christian-kam wants to merge 3 commits intoaws-samples:mainfrom
Conversation
| import subprocess | ||
| import sys | ||
| subprocess.check_call( | ||
| [sys.executable, "-m", "pip", "install", "mlflow", "sagemaker-mlflow==0.2.0", "-q"] |
There was a problem hiding this comment.
Why do we need to install MLflow packages when its already present in the requirements.txt
There was a problem hiding this comment.
Because I was using TrainingStep from sdk v3 and there is a bug with sagemaker.core.workflow.utilities.get_training_code_hash expects dependencies to be a list, but SourceCode.requirements is passed as a str see PR on the SDK v3
| return | ||
| try: | ||
| import mlflow | ||
| mlflow.end_run() |
There was a problem hiding this comment.
If you start the mlflow run with a python loop it automatically terminates the mlflow run.
Thats a standard way to use MLflow and this code design is deviating from MLflow best-practices
|
|
||
| # MLflow child run for evaluation | ||
| from mlflow_helper import setup_mlflow, end_mlflow | ||
| mlflow_enabled = setup_mlflow("EvaluateAbaloneModel") |
There was a problem hiding this comment.
Keeping in line with MLflow best practices: You need to set the experiment and for parent and child run chaining, pass the parent run when calling the child run.
See a similar example here which can be adopted for new version.
mlflow.set_tracking_uri(tracking_server_arn)
mlflow.set_experiment(experiment_name)
with mlflow.start_run(run_name=run_name) as run:
run_id = run.info.run_id
with mlflow.start_run(run_name="DataPreprocessing", nested=True):
There was a problem hiding this comment.
Ack. The approach that you are referring to, works best with @step decorator way of creating pipeline since Data flows between steps can be directly return as values (not S3 properties). I have rewritten the example to use the @step decorator approach and submitted a new PR feat: MLflow Apps steps for experiment tracking
|
Closing current PR to work from #103 |
Issue #, if available:
Description of changes:
Adding MLflow Apps for experiment tracking and updated the README
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.