You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
try:
fromkeras.utilsimportconv_utils# in Keras for TF >= 2.6exceptModuleNotFoundError:
fromtensorflow.python.keras.utilsimportconv_utils# in TF.python for TF <= 2.5
In tensorflow>=2.13 the new path for conv_utils is tensorflow.python.keras.utils. Unfortunately, attempting to import with from keras.utils import conv_utilsdoes not yield a ModuleNotFoundError becasue the module exists: instead, it simply yield a ImportError.
Since ImportError is not ModuleNotFoundError the except does not catch anything.
Solution
However observe that per this post that ModuleNotFoundError is an instance of ImportError , therefore we should replace the exception with a more general one.
The text was updated successfully, but these errors were encountered:
Hi @Algue-Rythme,
TensorFlow indeed changed (again) the way conv_utils is imported... @danibene suggested in a previous PR to fix this issue (04b03f8). His commit was integrated in a broader PR #76 with corrections for other failures introduced by TF 2.13.
However, we didn't notice that ModuleNotFoundError is a subclass of ImportError. We can simplify the open PR #76 with your proposition.
Version
Tensorflow: 2.13
Deel.lip 1.4.0
Issue
In file : https://github.com/deel-ai/deel-lip/blob/master/deel/lip/layers/convolutional.py
There is the code:
In tensorflow>=2.13 the new path for
conv_utils
istensorflow.python.keras.utils
. Unfortunately, attempting to import withfrom keras.utils import conv_utils
does not yield aModuleNotFoundError
becasue the module exists: instead, it simply yield aImportError
.Since
ImportError
is notModuleNotFoundError
theexcept
does not catch anything.Solution
However observe that per this post that
ModuleNotFoundError
is an instance ofImportError
, therefore we should replace the exception with a more general one.The text was updated successfully, but these errors were encountered: