diff --git a/requirements.txt b/requirements.txt index 8a5f36d6..d1fb5547 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ seaborn>=0.11.0 # nvidia-pyindex # TensorRT export # nvidia-tensorrt # TensorRT export # 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 # tensorflowjs>=3.9.0 # TF.js export # openvino-dev>=2023.0 # OpenVINO export diff --git a/setup.py b/setup.py index ccd0c8aa..4af3b5f2 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,7 @@ setup( 'export': [ 'coremltools>=7.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 ], }, classifiers=[ diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index d1d88723..3469720c 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = '8.0.214' +__version__ = '8.0.215' from ultralytics.models import RTDETR, SAM, YOLO from ultralytics.models.fastsam import FastSAM diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 2fb6f720..0a787f8b 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -653,6 +653,11 @@ class Exporter: 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__}...') + 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')) if f.is_dir(): import shutil diff --git a/ultralytics/utils/checks.py b/ultralytics/utils/checks.py index e830978f..cbc1894a 100644 --- a/ultralytics/utils/checks.py +++ b/ultralytics/utils/checks.py @@ -149,7 +149,8 @@ def check_version(current: str = '0.0.0', required: str = '0.0.0', name: str = 'version', hard: bool = False, - verbose: bool = False) -> bool: + verbose: bool = False, + msg: str = '') -> bool: """ 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. 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. + msg (str, optional): Extra message to display if verbose. Returns: (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): result = False 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: raise ModuleNotFoundError(emojis(warning_message)) # assert version requirements met if verbose: