Reputation: 1
I am writing masters thesis about deeplearning and have a problem probably about library.
Below is the error:
AttributeError: module 'tensorflow.compat.v2' has no attribute '__internal__'
Model:
import tensorflow
from tensorflow import keras
from keras import models
from keras import layers
model = models.Sequential()
model.add(layers.Dense(32, input_shape=(784,)))
model.add(layers.Dense(32))
Upvotes: 0
Views: 158
Reputation: 159
I have run exactly your code, and it works.
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense (Dense) (None, 32) 25120
dense_1 (Dense) (None, 32) 1056
=================================================================
Total params: 26,176
Trainable params: 26,176
Non-trainable params: 0
_________________________________________________________________
I am using tensorflow 2.12.0, on a Windows 10 DELL laptop. Please, indicate your tensorflow version. You can try removing both tensorflow and keras, and redoing the installation. I have performed my installation via pip, but, if you prefer, you can use also conda.
Upvotes: 0
Reputation: 1
most likely is the version of tensorflow you are using You just need to uninstall all keras and tensorflow packages and install the versions supported by Retinanet.
!pip uninstall keras -y !pip uninstall keras-nightly -y !pip uninstall keras-Preprocessing -y !pip uninstall keras-vis -y !pip uninstall tensorflow -y
!pip install tensorflow==2.3.0 !pip install keras==2.4
Just add this to the top of your colab notebook and restart your runtime once its completed and then you are good to go
Upvotes: 0
Reputation: 61
I think that the problem lies in the way you are importing the modules you need. Try to do this way:
import tensorflow
from tensorflow.keras import models, layers
model = models.Sequential()
model.add(layers.Dense(32, input_shape=(784,)))
model.add(layers.Dense(32))
model.summary()
If you get the summary of your network it means that everything is working fine, otherwise it could me that you haven't installed Tensorflow properly.
For reference this is the summary:
Layer (type) Output Shape Param #
=================================================================
dense (Dense) (None, 32) 25120
_________________________________________________________________
dense_1 (Dense) (None, 32) 1056
=================================================================
Total params: 26,176
Trainable params: 26,176
Non-trainable params: 0
_________________________________________________________________
Upvotes: 1