Open amandeep25 opened 3 years ago
`embedding_layer = Embedding(max_features, embed_size, input_length=max_senten_len, weights=[embedding_matrix])
word_input = Input(shape, dtype='int32') word_seq = embedding_layer(word_input) word_lstm = Bidirectional(LSTM(100, return_sequences=True))(word_seq) word_dense = TimeDistributed(Dense(200))(word_lstm) word_att = AttentionWithContext()(word_dense) wordEncoder = Model(word_input, word_att)
sente_input = Input(shape=(max_senten_num, max_senten_len), dtype='int32') sente = TimeDistributed(wordEncoder)(sente_input) sente = SpatialDropout1D(0.2)(sente) sente = Bidirectional(LSTM(128, return_sequences=True))(sente) sente = AttentionWithContext()(sente) preds = Dense(6, activation='sigmoid')(sente) model = Model(sente_input, preds) opt = Adam(clipnorm=5.0)
model.compile(loss='binary_crossentropy', optimizer=opt, metrics=['acc'])`
Getting error in this bold line. What is the solution? Do I need to downgrade the Keras version from 2.4.3?
Would be better to have the error traceback.
`embedding_layer = Embedding(max_features, embed_size, input_length=max_senten_len, weights=[embedding_matrix])
word_input = Input(shape, dtype='int32') word_seq = embedding_layer(word_input) word_lstm = Bidirectional(LSTM(100, return_sequences=True))(word_seq) word_dense = TimeDistributed(Dense(200))(word_lstm) word_att = AttentionWithContext()(word_dense) wordEncoder = Model(word_input, word_att)
sente_input = Input(shape=(max_senten_num, max_senten_len), dtype='int32') sente = TimeDistributed(wordEncoder)(sente_input) sente = SpatialDropout1D(0.2)(sente) sente = Bidirectional(LSTM(128, return_sequences=True))(sente) sente = AttentionWithContext()(sente) preds = Dense(6, activation='sigmoid')(sente) model = Model(sente_input, preds) opt = Adam(clipnorm=5.0)
model.compile(loss='binary_crossentropy', optimizer=opt, metrics=['acc'])`
Getting error in this bold line. What is the solution? Do I need to downgrade the Keras version from 2.4.3?