Skip to content

Commit

Permalink
To fix #3277 (#3280)
Browse files Browse the repository at this point in the history
* To fix #3277

To fix #3277 , replace `_VALID_PARAM_AND_METRIC_NAMES ` to regular expression from `mlflow`

https://github.com/mlflow/mlflow/blob/d6625d6df85b61f3661ba90efc36f94511a5c23f/mlflow/utils/validation.py#L15C1-L15C60

* autopep8 fix

* Update mlflow_logger.py

* Update ignite/handlers/mlflow_logger.py

* Update mlflow_logger.py

Remove `import re`

---------

Co-authored-by: puhuk <puhuk@users.noreply.github.com>
Co-authored-by: vfdev <vfdev.5@gmail.com>
  • Loading branch information
3 people authored Sep 9, 2024
1 parent e194891 commit 653fb9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ignite/handlers/mlflow_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ def __call__(self, engine: Engine, logger: MLflowLogger, event_name: Union[str,
)

# Additionally recheck metric names as MLflow rejects non-valid names with MLflowException
from mlflow.utils.validation import _VALID_PARAM_AND_METRIC_NAMES
from mlflow.utils.validation import validate_param_and_metric_name

metrics = {}
for keys, value in rendered_metrics.items():
key = " ".join(keys)
metrics[key] = value

for key in list(metrics.keys()):
if not _VALID_PARAM_AND_METRIC_NAMES.match(key):
if not validate_param_and_metric_name(key):
warnings.warn(
f"MLflowLogger output_handler encountered an invalid metric name '{key}' that "
"will be ignored and not logged to MLflow"
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tensorboardX
visdom
polyaxon
wandb
mlflow<2.16.0 # https://github.com/pytorch/ignite/issues/3277
mlflow
neptune-client>=0.16.17
tensorboard
torchvision
Expand Down

0 comments on commit 653fb9e

Please sign in to comment.