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

single_channel
Ivan Shcheklein 1 year ago committed by GitHub
parent 29c954a138
commit 3892e38021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,8 @@
# Ultralytics YOLO 🚀, GPL-3.0 license # Ultralytics YOLO 🚀, GPL-3.0 license
import os import os
import pkg_resources as pkg
from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING
from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
@ -10,8 +12,12 @@ try:
import dvclive import dvclive
assert not TESTS_RUNNING # do not log pytest 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 = None
# DVCLive logger instance # DVCLive logger instance

Loading…
Cancel
Save