aimacode / aima-python

Python implementation of algorithms from Russell And Norvig's "Artificial Intelligence - A Modern Approach"
MIT License
8.07k stars 3.81k forks source link

FAILED tests/test_deep_learning4e.py::test_rnn - AttributeError: module 'keras.preprocessing.sequence' #1262

Open ailabuser opened 2 years ago

ailabuser commented 2 years ago

FAILED tests/test_deep_learning4e.py::test_rnn - AttributeError: module 'keras.preprocessing.sequence' has no attribute 'pad_sequences'

Need to replace 'keras.preprocessing.sequence' with 'keras_preprocessing.sequence'

Python 3.8.13, Tensorflow 2.10.0, Keras 2.10.0

EnthusiasticTeslim commented 2 years ago

Yes, the py.test failed because of this issue. It is noteworthy to mention that the attribute has been moved to keras.utils in keras 2.9....In your deep_learning4e.py file, replace

from keras.preprocessing import sequence

with

from keras.utils import pad_sequences

Cheers, Teslim.

image
liukkcggvb commented 1 year ago

Yes, the py.test failed because of this issue. It is noteworthy to mention that the attribute has been moved to keras.utils in keras 2.9....In your deep_learning4e.py file, replace

from keras.preprocessing import sequence

with

from keras.utils import pad_sequences

Cheers, Teslim. image

Your answer helped me, to add, let's remove "sequences." from all sequence.pad_sequences in the file.

talessl commented 1 year ago

thank u so much for help me, both of u!