Skip to content

Commit 7d786af

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent dc49140 commit 7d786af

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lightning/pytorch/loggers/mlflow.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ def __init__(
132132
run_id: Optional[str] = None,
133133
synchronous: Optional[bool] = None,
134134
):
135-
136135
if not _MLFLOW_AVAILABLE:
137136
raise ModuleNotFoundError(str(_MLFLOW_AVAILABLE))
138137
if synchronous is not None and not _MLFLOW_SYNCHRONOUS_AVAILABLE:
@@ -209,7 +208,7 @@ def experiment(self) -> "MlflowClient":
209208
resolve_tags = _get_resolve_tags()
210209
run = self._mlflow_client.create_run(experiment_id=self._experiment_id, tags=resolve_tags(self.tags))
211210
self._run_id = run.info.run_id
212-
self._logged_metrics.clear()
211+
self._logged_metrics.clear()
213212
self._initialized = True
214213
return self._mlflow_client
215214

@@ -266,7 +265,7 @@ def log_metrics(self, metrics: Mapping[str, float], step: Optional[int] = None)
266265
if isinstance(v, str):
267266
log.warning(f"Discarding metric with string value {k}={v}.")
268267
continue
269-
268+
270269
new_k = re.sub("[^a-zA-Z0-9_/. -]+", "", k)
271270
if k != new_k:
272271
rank_zero_warn(
@@ -275,14 +274,13 @@ def log_metrics(self, metrics: Mapping[str, float], step: Optional[int] = None)
275274
category=RuntimeWarning,
276275
)
277276
k = new_k
278-
277+
279278
metric_id = (k, step or 0)
280279
if metric_id in self._logged_metrics:
281-
continue
280+
continue
282281
self._logged_metrics.add(metric_id)
283-
284-
metrics_list.append(Metric(key=k, value=v, timestamp=timestamp_ms, step=step or 0))
285282

283+
metrics_list.append(Metric(key=k, value=v, timestamp=timestamp_ms, step=step or 0))
286284

287285
self.experiment.log_batch(run_id=self.run_id, metrics=metrics_list, **self._log_batch_kwargs)
288286

0 commit comments

Comments
 (0)