-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parent run missing in MLFlow when using nested trials #153
Comments
One workaround I found is to manually create a parent run and set the Is this the correct way to achieve nested runs? If so it would be helpful if this was described in the docs: https://optuna.readthedocs.io/en/stable/reference/generated/optuna.integration.MLflowCallback.html def get_or_create_experiment(name, artifact_location=None):
experiment = mlflow.get_experiment_by_name(name)
if not experiment:
experiment_id = mlflow.create_experiment(name, artifact_location)
experiment = mlflow.get_experiment(experiment_id)
return experiment
experiment = get_or_create_experiment("My experiment")
with mlflow.start_run(run_name="Hyperparameter tuning", experiment_id=experiment.experiment_id) as parent_run:
study = optuna.create_study(study_name=experiment.name, direction='minimize', load_if_exists=True)
mlflow.parentRunId = parent_run.info.run_id
study.optimize(objective, n_trials=2, callbacks=[mflow_callback])
mlflow.log_metric("best_value", study.best_value)
mlflow.log_metrics(study.best_params) |
Thank you for creating this. I think your workaround makes sense because the current mlflow callback does not create a parent experiment. |
If we implement this feature, do you expect the following behaviour?
|
Expected behavior
Using
MLflowCallback(mlflow_kwargs={"nested": True})
I expect each trial to be grouped under a parent run in MLFlow tracker UI.Environment
Error messages, stack traces, or logs
Steps to reproduce
Additional context (optional)
Perhaps my setup is missing something? Or is this there a different recommended way to group hyperparameter runs?
As you can see, each trial appear as individual runs:
Thanks!
The text was updated successfully, but these errors were encountered: