ultralytics 8.0.185 dependencies and tests fixes (#5046)
Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
92753ebd84
commit
a9033118cf
13 changed files with 149 additions and 23 deletions
|
|
@ -61,9 +61,7 @@ def parse_version(version='0.0.0') -> tuple:
|
|||
(tuple): Tuple of integers representing the numeric part of the version and the extra string, i.e. (2, 0, 1)
|
||||
"""
|
||||
try:
|
||||
correct = [True if x == '.' else x.isdigit() for x in version] # first non-number index
|
||||
v = version[:correct.index(False)] if False in correct else version
|
||||
return tuple(map(int, v.split('.'))) # '2.0.1+cpu' -> (2, 0, 1)
|
||||
return tuple(map(int, re.findall(r'\d+', version)[:3])) # '2.0.1+cpu' -> (2, 0, 1)
|
||||
except Exception as e:
|
||||
LOGGER.warning(f'WARNING ⚠️ failure for parse_version({version}), reverting to deprecated pkg_resources: {e}')
|
||||
import pkg_resources
|
||||
|
|
@ -166,9 +164,12 @@ def check_version(current: str = '0.0.0',
|
|||
# check if current version is between 20.04 (inclusive) and 22.04 (exclusive)
|
||||
check_version(current='21.10', required='>20.04,<22.04')
|
||||
"""
|
||||
if not (current and required): # if any inputs missing
|
||||
if not current: # if current is '' or None
|
||||
LOGGER.warning(f'WARNING ⚠️ invalid check_version({current}, {required}) requested, please check values.')
|
||||
return True # in case required is '' or None
|
||||
return True
|
||||
|
||||
if not required: # if required is '' or None
|
||||
return True
|
||||
|
||||
current = parse_version(current) # '1.2.3' -> (1, 2, 3)
|
||||
constraints = re.findall(r'([<>!=]{1,2}\s*\d+\.\d+)', required) or [f'>={required}']
|
||||
|
|
@ -492,9 +493,9 @@ def collect_system_info():
|
|||
f"{'CPU':<20}{get_cpu_info()}\n"
|
||||
f"{'CUDA':<20}{torch.version.cuda if torch and torch.cuda.is_available() else None}\n")
|
||||
|
||||
if (ROOT.parent / 'requirements.txt').exists(): # pip install
|
||||
if (ROOT.parent / 'requirements.txt').exists(): # git install
|
||||
requirements = parse_requirements()
|
||||
else: # git install
|
||||
else: # pip install
|
||||
from pkg_resources import get_distribution
|
||||
requirements = get_distribution('ultralytics').requires()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue