ModuleNotFoundError: No module named 'tensorflow.python.keras.layers.preprocessing'

I am training a tensorflow model locally and I got this error when I run the file:
ModuleNotFoundError: No module named ‘tensorflow.python.keras.layers.preprocessing’
also this, ModuleNotFoundError: No module named ‘official.legacy’
I imported all the necessary modules and libraries. Will be very grateful to anyone who can help me with this. Thanks.

Hi @Durga_Saranyu_D_K, To overcome this error please install tf-models-official using pip install tf-models-official.

Could you please try by import keras.layers.experimental.preprocessing.

Thank You.

Thank you so much. I am able to run the file file without that error, but I ended up with this error, can you suggest a fix for this:
AttributeError: module ‘’ has no attribute ‘Open’

I was able to fix the issue by replacing Open with GFile. Thank you for your input.