Skip to content

Commit

Permalink
Moving check in export script
Browse files Browse the repository at this point in the history
  • Loading branch information
Corallo committed Dec 11, 2023
1 parent d80fec0 commit ad86299
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,9 @@ def export_saved_model(model,
from models.tf import TFModel

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/yolov5/issues/12489')
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

Expand Down
4 changes: 2 additions & 2 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,11 @@ def check_python(minimum='3.8.0'):
check_version(platform.python_version(), minimum, name='Python ', hard=True)


def check_version(current='0.0.0', minimum='0.0.0', name='version ', pinned=False, hard=False, verbose=False, msg=''):
def check_version(current='0.0.0', minimum='0.0.0', name='version ', pinned=False, hard=False, verbose=False):
# Check version vs. required version
current, minimum = (pkg.parse_version(x) for x in (current, minimum))
result = (current == minimum) if pinned else (current >= minimum) # bool
s = f'WARNING ⚠️ {name}{minimum} is required by YOLOv5, but {name}{current} is currently installed {msg}' # string
s = f'WARNING ⚠️ {name}{minimum} is required by YOLOv5, but {name}{current} is currently installed' # string
if hard:
assert result, emojis(s) # assert min requirements met
if verbose and not result:
Expand Down

0 comments on commit ad86299

Please sign in to comment.