Lightning-AI / pytorch-lightning

Pretrain, finetune and deploy AI models on multiple GPUs, TPUs with zero code changes.

Home Page:https://lightning.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Increase MlflowLogger parameter value length limit

jhjo432 opened this issue · comments

Description & Motivation

Currently, MlflowLogger parameter value length is limited to 250 (#5893) which is too low for class names, data augmentations or others.
Recent MLflow support up to 6000 (mlflow/mlflow#9709).

Pitch

MLflow use mlflow.utils.validation.MAX_PARAM_VAL_LENGTH to validate parameter value length.
mlflow.utils.validation.MAX_PARAM_VAL_LENGTH exist in mlflow >= 1.0
I believe we can use it to reliably truncate parameter value without checking MLflow version.

class MLFlowLogger(Logger):
    @rank_zero_only
    def log_hyperparams(self, params: Union[Dict[str, Any], Namespace]) -> None:  # type: ignore[override]
        ...
        from mlflow.utils.validation import MAX_PARAM_VAL_LENGTH
        # Truncate parameter values to MAX_PARAM_VAL_LENGTH characters.
        params_list = [Param(key=k, value=str(v)[:MAX_PARAM_VAL_LENGTH]) for k, v in params.items()]
        ...

Alternatives

No response

Additional context

No response

cc @Borda