Add tensorflow<=2.13.1 checks and comments (#6466)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher 2023-11-20 17:47:44 +01:00 committed by GitHub
parent 618923ab11
commit d2aa6b3570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 5 deletions

View File

@ -30,7 +30,7 @@ seaborn>=0.11.0
# nvidia-pyindex # TensorRT export # nvidia-pyindex # TensorRT export
# nvidia-tensorrt # TensorRT export # nvidia-tensorrt # TensorRT export
# scikit-learn==0.19.2 # CoreML quantization # scikit-learn==0.19.2 # CoreML quantization
# tensorflow>=2.4.1 # TF exports (-cpu, -aarch64, -macos) # tensorflow>=2.4.1,<=2.13.1 # TF exports (-cpu, -aarch64, -macos)
# tflite-support # tflite-support
# tensorflowjs>=3.9.0 # TF.js export # tensorflowjs>=3.9.0 # TF.js export
# openvino-dev>=2023.0 # OpenVINO export # openvino-dev>=2023.0 # OpenVINO export

View File

@ -80,7 +80,7 @@ setup(
'export': [ 'export': [
'coremltools>=7.0', 'coremltools>=7.0',
'openvino-dev>=2023.0', 'openvino-dev>=2023.0',
'tensorflow<=2.13.1', 'tensorflow<=2.13.1', # TF bug https://github.com/ultralytics/ultralytics/issues/5161
'tensorflowjs', # automatically installs tensorflow 'tensorflowjs', # automatically installs tensorflow
], }, ], },
classifiers=[ classifiers=[

View File

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license # Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = '8.0.214' __version__ = '8.0.215'
from ultralytics.models import RTDETR, SAM, YOLO from ultralytics.models import RTDETR, SAM, YOLO
from ultralytics.models.fastsam import FastSAM from ultralytics.models.fastsam import FastSAM

View File

@ -653,6 +653,11 @@ class Exporter:
cmds='--extra-index-url https://pypi.ngc.nvidia.com') # onnx_graphsurgeon only on NVIDIA cmds='--extra-index-url https://pypi.ngc.nvidia.com') # onnx_graphsurgeon only on NVIDIA
LOGGER.info(f'\n{prefix} starting export with tensorflow {tf.__version__}...') LOGGER.info(f'\n{prefix} starting export with tensorflow {tf.__version__}...')
check_version(tf.__version__,
'<=2.13.1',
name='tensorflow',
verbose=True,
msg='https://github.com/ultralytics/ultralytics/issues/5161')
f = Path(str(self.file).replace(self.file.suffix, '_saved_model')) f = Path(str(self.file).replace(self.file.suffix, '_saved_model'))
if f.is_dir(): if f.is_dir():
import shutil import shutil

View File

@ -149,7 +149,8 @@ def check_version(current: str = '0.0.0',
required: str = '0.0.0', required: str = '0.0.0',
name: str = 'version', name: str = 'version',
hard: bool = False, hard: bool = False,
verbose: bool = False) -> bool: verbose: bool = False,
msg: str = '') -> bool:
""" """
Check current version against the required version or range. Check current version against the required version or range.
@ -159,6 +160,7 @@ def check_version(current: str = '0.0.0',
name (str, optional): Name to be used in warning message. name (str, optional): Name to be used in warning message.
hard (bool, optional): If True, raise an AssertionError if the requirement is not met. hard (bool, optional): If True, raise an AssertionError if the requirement is not met.
verbose (bool, optional): If True, print warning message if requirement is not met. verbose (bool, optional): If True, print warning message if requirement is not met.
msg (str, optional): Extra message to display if verbose.
Returns: Returns:
(bool): True if requirement is met, False otherwise. (bool): True if requirement is met, False otherwise.
@ -212,7 +214,8 @@ def check_version(current: str = '0.0.0',
elif op == '<' and not (c < v): elif op == '<' and not (c < v):
result = False result = False
if not result: if not result:
warning_message = f'WARNING ⚠️ {name}{op}{required} is required, but {name}=={current} is currently installed' warning_message = \
f'WARNING ⚠️ {name}{op}{required} is required, but {name}=={current} is currently installed {msg}'
if hard: if hard:
raise ModuleNotFoundError(emojis(warning_message)) # assert version requirements met raise ModuleNotFoundError(emojis(warning_message)) # assert version requirements met
if verbose: if verbose: