@@ -132,7 +132,6 @@ def __init__(
132
132
run_id : Optional [str ] = None ,
133
133
synchronous : Optional [bool ] = None ,
134
134
):
135
-
136
135
if not _MLFLOW_AVAILABLE :
137
136
raise ModuleNotFoundError (str (_MLFLOW_AVAILABLE ))
138
137
if synchronous is not None and not _MLFLOW_SYNCHRONOUS_AVAILABLE :
@@ -209,7 +208,7 @@ def experiment(self) -> "MlflowClient":
209
208
resolve_tags = _get_resolve_tags ()
210
209
run = self ._mlflow_client .create_run (experiment_id = self ._experiment_id , tags = resolve_tags (self .tags ))
211
210
self ._run_id = run .info .run_id
212
- self ._logged_metrics .clear ()
211
+ self ._logged_metrics .clear ()
213
212
self ._initialized = True
214
213
return self ._mlflow_client
215
214
@@ -266,7 +265,7 @@ def log_metrics(self, metrics: Mapping[str, float], step: Optional[int] = None)
266
265
if isinstance (v , str ):
267
266
log .warning (f"Discarding metric with string value { k } ={ v } ." )
268
267
continue
269
-
268
+
270
269
new_k = re .sub ("[^a-zA-Z0-9_/. -]+" , "" , k )
271
270
if k != new_k :
272
271
rank_zero_warn (
@@ -275,14 +274,13 @@ def log_metrics(self, metrics: Mapping[str, float], step: Optional[int] = None)
275
274
category = RuntimeWarning ,
276
275
)
277
276
k = new_k
278
-
277
+
279
278
metric_id = (k , step or 0 )
280
279
if metric_id in self ._logged_metrics :
281
- continue
280
+ continue
282
281
self ._logged_metrics .add (metric_id )
283
-
284
- metrics_list .append (Metric (key = k , value = v , timestamp = timestamp_ms , step = step or 0 ))
285
282
283
+ metrics_list .append (Metric (key = k , value = v , timestamp = timestamp_ms , step = step or 0 ))
286
284
287
285
self .experiment .log_batch (run_id = self .run_id , metrics = metrics_list , ** self ._log_batch_kwargs )
288
286
0 commit comments