fix(loggers): DVCLive add package version check (#3112)

This commit is contained in:
Ivan Shcheklein
2023-06-09 02:19:34 -07:00
committed by GitHub
parent 29c954a138
commit 3892e38021

View File

@ -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