Skip to content

Commit

Permalink
Add tensorflow<=2.13.1 checks and comments (ultralytics#6466)
Browse files Browse the repository at this point in the history
Signed-off-by: Glenn Jocher <[email protected]>
  • Loading branch information
glenn-jocher authored Nov 20, 2023
1 parent 618923a commit d2aa6b3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def parse_requirements(file_path: Path):
'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=[
Expand Down
2 changes: 1 addition & 1 deletion ultralytics/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions ultralytics/engine/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,11 @@ def export_saved_model(self, prefix=colorstr('TensorFlow SavedModel:')):
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
Expand Down
7 changes: 5 additions & 2 deletions ultralytics/utils/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d2aa6b3

Please sign in to comment.