Reputation: 51
I have been running several deep learning models in google colab using Keras. My codes worked perfectly but suddenly, today, a lot of errors appeared reporting problemas with the imports. Pasting one here.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-745bb0894037> in <module>()
19 from keras.preprocessing.image import ImageDataGenerator
20 from keras.utils import np_utils
---> 21 from keras_contrib.applications.densenet import DenseNetFCN
22 from keras_contrib.losses.jaccard import jaccard_distance
1 frames
/usr/local/lib/python3.7/dist-packages/keras_contrib/applications/densenet.py in <module>()
66 from keras.layers import BatchNormalization
67 from keras.regularizers import l2
---> 68 from keras.utils.layer_utils import convert_all_kernels_in_model
69 from keras.utils.data_utils import get_file
70 from keras.engine.topology import get_source_inputs
ImportError: cannot import name 'convert_all_kernels_in_model' from 'keras.utils.layer_utils' (/usr/local/lib/python3.7/dist-packages/keras/utils/layer_utils.py)
Upvotes: 1
Views: 1366
Reputation: 51
so I am answering my question for anyone who might have trouble with it. They updated Tensorflow and Keras in Colab to 2.5 versions, and some functions are not migrated (i.e. convert_all_kernels_in_model). For me, the solution was to paste the code of the NN architecture and comment the line with that function as I was not using it. I know it is not the best solution but it got me through what I needed.
Upvotes: 1
Reputation: 38579
The final release of TensorFlow version 2.5 requires a nightly dev build of keras that seems to be the source of these issues. https://github.com/tensorflow/tensorflow/blob/v2.5.0/tensorflow/tools/pip_package/setup.py#L107
The relevant TensorFlow issue to report your experience is: https://github.com/tensorflow/tensorflow/issues/49823
Upvotes: 0