tensorflow-deep-learning icon indicating copy to clipboard operation
tensorflow-deep-learning copied to clipboard

07_food_vision_milestone_project_1.ipynb - In:29

Open vl0 opened this issue 2 years ago • 4 comments

So when I run cell 29 I get the following error. The GPU is "GPU 0: Tesla T4 (UUID: GPU-6b3d416d-69cc-a08d-bde3-f0e6c29fdd87)".


TypeError Traceback (most recent call last)

in 3 # Create base model 4 input_shape = (224, 224, 3) ----> 5 base_model = tf.keras.applications.EfficientNetB0(include_top=False) 6 base_model.trainable = False # freeze base model layers 7

4 frames

/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs) 65 except Exception as e: # pylint: disable=broad-except 66 filtered_tb = _process_traceback_frames(e.traceback) ---> 67 raise e.with_traceback(filtered_tb) from None 68 finally: 69 del filtered_tb

TypeError: Exception encountered when calling layer "tf.math.truediv" (type TFOpLambda).

x and y must have the same dtype, got tf.float16 != tf.float32.

Call arguments received by layer "tf.math.truediv" (type TFOpLambda): • x=tf.Tensor(shape=(None, None, None, 3), dtype=float16) • y=tf.Tensor(shape=(3,), dtype=float32) • name=None

vl0 avatar Dec 09 '22 21:12 vl0

Downgrade your tensorflow version to 2.7. Restart your runtime it should fix this issue.

SaketMunda avatar Jan 16 '23 07:01 SaketMunda

Downgrade your tensorflow version to 2.7. Restart your runtime it should fix this issue.

It worked! Thanks a bunch, it was driving me crazy

vl0 avatar Jan 16 '23 09:01 vl0

TensorFlow version 2.8 works as well!

sgkouzias avatar Jan 23 '23 21:01 sgkouzias

Thank you for helping @SaketMunda and @Encode-0 !

mrdbourke avatar Jan 26 '23 02:01 mrdbourke