From a04b49f1aa2aa25b246b6bd1d9e909924ee8019a Mon Sep 17 00:00:00 2001 From: Angelo Delli Santi Date: Sat, 16 Dec 2023 23:31:22 +0100 Subject: [PATCH] Limit tensorflow version and add checks (#12494) * Limit tensorflow version and add checks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Moving check in export script * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- export.py | 5 +++++ requirements.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/export.py b/export.py index 71e4eb94d1c4..5611ab95b1dc 100644 --- a/export.py +++ b/export.py @@ -397,6 +397,11 @@ def export_saved_model(model, from models.tf import TFModel LOGGER.info(f'\n{prefix} starting export with tensorflow {tf.__version__}...') + if tf.__version__ > '2.13.1': + helper_url = 'https://github.com/ultralytics/yolov5/issues/12489' + LOGGER.info( + f'WARNING ⚠️ using Tensorflow {tf.__version__} > 2.13.1 might cause issue when exporting the model to tflite {helper_url}' + ) # handling issue https://github.com/ultralytics/yolov5/issues/12489 f = str(file).replace('.pt', '_saved_model') batch_size, ch, *imgsz = list(im.shape) # BCHW diff --git a/requirements.txt b/requirements.txt index 63f4a9125415..115055b1629c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,7 +34,7 @@ seaborn>=0.11.0 # nvidia-pyindex # TensorRT export # nvidia-tensorrt # TensorRT export # scikit-learn<=1.1.2 # CoreML quantization -# tensorflow>=2.4.0 # TF exports (-cpu, -aarch64, -macos) +# tensorflow>=2.4.0,<=2.13.1 # TF exports (-cpu, -aarch64, -macos) # tensorflowjs>=3.9.0 # TF.js export # openvino-dev>=2023.0 # OpenVINO export