mirror of
https://github.com/wassname/ray.git
synced 2026-07-14 11:17:54 +08:00
[tune] Added logger_config field (#8521)
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
This commit is contained in:
@@ -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()))
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user