[tune] Added logger_config field (#8521)

Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
This commit is contained in:
Tomasz Wrona
2020-08-18 20:10:22 +02:00
committed by GitHub
parent eacf7dddba
commit aff7f19360
3 changed files with 12 additions and 3 deletions
+3 -1
View File
@@ -41,7 +41,9 @@ if __name__ == "__main__":
num_samples=5,
loggers=DEFAULT_LOGGERS + (MLFLowLogger, ),
config={
"mlflow_experiment_id": experiment_id,
"logger_config": {
"mlflow_experiment_id": experiment_id,
},
"width": tune.sample_from(
lambda spec: 10 + int(90 * random.random())),
"height": tune.sample_from(lambda spec: int(100 * random.random()))
+5 -2
View File
@@ -78,9 +78,12 @@ class MLFLowLogger(Logger):
"""
def _init(self):
logger_config = self.config.get("logger_config", {})
from mlflow.tracking import MlflowClient
client = MlflowClient()
run = client.create_run(self.config.get("mlflow_experiment_id"))
client = MlflowClient(
tracking_uri=logger_config.get("mlflow_tracking_uri"),
registry_uri=logger_config.get("mlflow_registry_uri"))
run = client.create_run(logger_config.get("mlflow_experiment_id"))
self._run_id = run.info.run_id
for key, value in self.config.items():
client.log_param(self._run_id, key, value)