From 653fb9ea0a22f13695ddd8f90508269957f427e6 Mon Sep 17 00:00:00 2001 From: puhuk Date: Tue, 10 Sep 2024 07:14:47 +0900 Subject: [PATCH] To fix #3277 (#3280) * 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 Co-authored-by: vfdev --- ignite/handlers/mlflow_logger.py | 4 ++-- requirements-dev.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ignite/handlers/mlflow_logger.py b/ignite/handlers/mlflow_logger.py index 68a996d8fb1..916f51bd687 100644 --- a/ignite/handlers/mlflow_logger.py +++ b/ignite/handlers/mlflow_logger.py @@ -245,7 +245,7 @@ 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(): @@ -253,7 +253,7 @@ def __call__(self, engine: Engine, logger: MLflowLogger, event_name: Union[str, 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" diff --git a/requirements-dev.txt b/requirements-dev.txt index 732a0544b71..d475e556cdf 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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