Using vectorize_words leads to AttributeError
Hello,
I am using keras ==2.9.0 and tensorflow ==2.9.1. I'm using pretrained eng_50 model like so --
c2v_model = chars2vec.load_model('eng_50')
However, when I use the vectorize_words method on my list of strings, I get the following AttributeError:
c2v_model.vectorize_words(std_job_list)
AttributeError Traceback (most recent call last)
~/anaconda3/envs/JupyterSystemEnv/lib/python3.7/site-packages/chars2vec/model.py in vectorize_words(self, words, maxlen_padseq) 150 list_of_embeddings.append(np.array(current_embedding)) 151 --> 152 embeddings_pad_seq = keras.preprocessing.sequence.pad_sequences(list_of_embeddings, maxlen=maxlen_padseq) 153 new_words_vectors = self.embedding_model.predict([embeddings_pad_seq]) 154
AttributeError: module 'keras.preprocessing.sequence' has no attribute 'pad_sequences'
I'm not sure if there's a specific version I need to be using for keras/tensorflow. or if I'm missing something separate Any advice on this would be appreciated! Thanks
I am in the same situation and have the Attribute Error: module 'keras' has no attribute 'preprocessing'
Is it perhaps a versioning issue? What version of Keras was used in this project?
I got it to work with tensorflow==2.8.4, keras==2.8.0
I fixed it by replacing Keras with tf.compat.v1.keras in all instances