From 3892e38021adbf70d32c8f9e1d1e947372d8e031 Mon Sep 17 00:00:00 2001 From: Ivan Shcheklein Date: Fri, 9 Jun 2023 02:19:34 -0700 Subject: [PATCH] fix(loggers): DVCLive add package version check (#3112) --- ultralytics/yolo/utils/callbacks/dvc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ultralytics/yolo/utils/callbacks/dvc.py b/ultralytics/yolo/utils/callbacks/dvc.py index 61489aa..4b30109 100644 --- a/ultralytics/yolo/utils/callbacks/dvc.py +++ b/ultralytics/yolo/utils/callbacks/dvc.py @@ -1,6 +1,8 @@ # Ultralytics YOLO 🚀, GPL-3.0 license import os +import pkg_resources as pkg + from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params @@ -10,8 +12,12 @@ try: import dvclive assert not TESTS_RUNNING # do not log pytest - assert version('dvclive') -except (ImportError, AssertionError): + + ver = version('dvclive') + if pkg.parse_version(ver) < pkg.parse_version('2.11.0'): + LOGGER.debug(f'DVCLive is detected but version {ver} is incompatible (>=2.11 required).') + dvclive = None # noqa: F811 +except (ImportError, AssertionError, TypeError): dvclive = None # DVCLive logger instance