Skip to content Skip to sidebar Skip to footer

Cannot Import Name 'sequence' From 'keras.utils'

when I use 'import talos' I get the following error: Traceback (most recent call last): File 'C:/Users/Mirijam/Desktop/rp/RNN_classification/classification.py', line 4, in

Solution 1:

I was able to replicate your issue, you can refer working code as shown below

import talos
import keras

print(talos.__version__)
print(keras.__version__)

from keras.utils importSequence

Output:

1.0.0
2.5.0

ImportError                               Traceback (most recent call last)
<ipython-input-14-064232ea7706> in <module>()
----> 1 from keras.utils import Sequence # it wont workImportError: cannot import name 'Sequence' from 'keras.utils' (/usr/local/lib/python3.7/dist-packages/keras/utils/__init__.py)

Fixed code:

From Tensorflow 2.x onward, keras is no longer maintained and it became a part of Tensorflow. I would recommend instead of import Sequence from keras, you should try from tensorflow as shown below

from tensorflow.keras.utils importSequence

For more information you can refer here.

Post a Comment for "Cannot Import Name 'sequence' From 'keras.utils'"