RNN Keras LSTM model error


(Ilia) #1

Colleagues, I tried to run on CPU autosuggestion RNN LSTM model using Keras API from lesson 6:

model = Sequential([ Embedding(vocab_size, n_fac, input_length=maxlen), LSTM(512, input_dim=n_fac, return_sequences=True, dropout_U=0.2, dropout_W=0.2), Dropout(0.2), LSTM(512, return_sequences=True, dropout_U=0.2, dropout_W=0.2), Dropout(0.2), TimeDistributed(Dense(vocab_size)), Activation('softmax') ])

but model throws an error:

C:\Users\Gavrilov\Anaconda3\lib\site-packages\ipykernel_launcher.py:3: UserWarning: The input_dim and input_length arguments in recurrent layers are deprecated. Use input_shape instead.
This is separate from the ipykernel package so we can avoid doing imports until
C:\Users\Gavrilov\Anaconda3\lib\site-packages\ipykernel_launcher.py:3: UserWarning: Update your LSTM call to the Keras 2 API: LSTM(512, return_sequences=True, input_shape=(None, 24), dropout=0.2, recurrent_dropout=0.2)
This is separate from the ipykernel package so we can avoid doing imports until
C:\Users\Gavrilov\Anaconda3\lib\site-packages\ipykernel_launcher.py:5: UserWarning: Update your LSTM call to the Keras 2 API: LSTM(512, return_sequences=True, dropout=0.2, recurrent_dropout=0.2)
“”"

So far I was only able to run the model as follows:

model = Sequential([ Embedding(vocab_size, n_fac, input_length=maxlen), BatchNormalization(), LSTM(512, return_sequences=True), Dropout(0.2), TimeDistributed(Dense(vocab_size)), Activation('softmax') ])

but results aren’t that great. Would be really grateful if those errors explained.

P.S. I’m using Python 3.6 with only Tensorflow backend as ML library.
P.S. I looked up the same issue on a forum but didn’t find similar, sorry in advance if the topic already exists.