mrdbourke / tensorflow-deep-learning

All course materials for the Zero to Mastery Deep Learning with TensorFlow course.
https://dbourke.link/ZTMTFcourse
MIT License
5.14k stars 2.53k forks source link

07_food_vision_milestone_project_1.ipynb - In:29 #485

Open vl0 opened 1 year ago

vl0 commented 1 year ago

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

SaketMunda commented 1 year ago

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

vl0 commented 1 year ago

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

sgkouzias commented 1 year ago

TensorFlow version 2.8 works as well!

mrdbourke commented 1 year ago

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