Lightning-AI / Lightning-AI/pytorch-lightning
Increase MlflowLogger parameter value length limit
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### 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.
```python
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 @lantiga @borda
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at MLFlowLogger.log_hyperparams and review how parameter values are currently truncated to 250 characters. Check MLflow's MAX_PARAM_VAL_LENGTH behavior, then verify that logged parameter values are truncated to that limit without breaking existing logging behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100