Skip to content

Commit b9c46bd

Browse files
committed
use mlflow variable for truncation
1 parent 4ff8ff7 commit b9c46bd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/lightning/pytorch/loggers/mlflow.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,9 @@ def log_hyperparams(self, params: Union[dict[str, Any], Namespace]) -> None:
233233
params = _flatten_dict(params)
234234

235235
from mlflow.entities import Param
236+
from mlflow.utils.validation import MAX_PARAM_VAL_LENGTH
236237

237-
# Truncate parameter values to 250 characters.
238-
# TODO: MLflow 1.28 allows up to 500 characters: https://github.com/mlflow/mlflow/releases/tag/v1.28.0
239-
params_list = [Param(key=k, value=str(v)[:250]) for k, v in params.items()]
238+
params_list = [Param(key=k, value=str(v)[:MAX_PARAM_VAL_LENGTH]) for k, v in params.items()]
240239

241240
# Log in chunks of 100 parameters (the maximum allowed by MLflow).
242241
for idx in range(0, len(params_list), 100):

0 commit comments

Comments
 (0)