tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

assert float(tf.__version__[:3]) >= 2.3 triggers because actual version is > 2.10

Open MG-EuS opened this issue 2 years ago • 3 comments

Description

In retrain_classification_ptq_tf2.ipynb, there is a check assert float(tf.__version__[:3]) >= 2.3 that should check whether the used tensorflow version is at least 2.3 or higher. Now colab uses 2.13 as its standard. That is higher than 2.3 but the assert triggers, because it makes 2.13 seem like 2.1. And also the float number 2.13 is smaller than 2.3. But as a version number it is higher.

Click to expand!

Issue Type

Bug

Operating System

No response

Coral Device

No response

Other Devices

No response

Programming Language

No response

Relevant Log Output

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-13-b98ebe4840c4> in <cell line: 1>()
----> 1 assert float(tf.__version__[:3]) >= 2.3

AssertionError:

MG-EuS avatar Sep 22 '23 08:09 MG-EuS

Description

In retrain_classification_ptq_tf2.ipynb, there is a check assert float(tf.__version__[:3]) >= 2.3 that should check whether the used tensorflow version is at least 2.3 or higher. Now colab uses 2.13 as its standard. That is higher than 2.3 but the assert triggers, because it makes 2.13 seem like 2.1. And also the float number 2.13 is smaller than 2.3. But as a version number it is higher.

Click to expand!

Issue Type

Bug

Operating System

No response

Coral Device

No response

Other Devices

No response

Programming Language

No response

Relevant Log Output

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-13-b98ebe4840c4> in <cell line: 1>()
----> 1 assert float(tf.__version__[:3]) >= 2.3

AssertionError:

How to solve it for keep it running?

ahsanfi avatar Oct 31 '23 17:10 ahsanfi

Version numbers as floats are always a bad idea. Something like this should fix it:

from packaging import version

assert version.parse(tf.__version__) >= version.parse("2.3"), "TensorFlow version is not >= 2.3"

Alternatively if you prefer less dependencies:

version_numbers = tuple(map(int, tf.__version__.split('.')))
assert version_numbers >= (2, 3, 0), "TensorFlow version is not >= 2.3"

friedensfurz avatar Nov 05 '23 01:11 friedensfurz

Version numbers as floats are always a bad idea. Something like this should fix it:

from packaging import version

assert version.parse(tf.__version__) >= version.parse("2.3"), "TensorFlow version is not >= 2.3"

Alternatively if you prefer less dependencies:

version_numbers = tuple(map(int, tf.__version__.split('.')))
assert version_numbers >= (2, 3, 0), "TensorFlow version is not >= 2.3"

Hello, I have already managed to create a model. Now, how to run the model for live classification using web camera? I have following this tutorial https://coral.ai/docs/dev-board/camera/#view-with-a-streaming-server but the model cannot run. Thanks

WhatsApp Image 2023-11-02 at 00 57 27_93fe2b1d This is the error message

ahsanfi avatar Nov 05 '23 01:11 ahsanfi