问题描述
我已经通过互联网搜索来解决这个问题,但似乎没有人有解决方案。我想用 CRF 层改进我的 BiLSTM 模型,显然 Keras 不再支持它。我怎样才能添加这个?我不想为它更改我的整个 Keras 和 Tensorflow 版本。请帮帮我 :) 我有最新的 Keras 和 Tensorflow 版本。
#vocab_size=4840,embedding is glove6B,max_seq_length=100
model = Sequential()
model.add(Embedding(vocab_size,300,weights=[embedding_vectors],input_length=max_seq_length,trainable= False))
model.add(Bidirectional(LSTM(units=50,dropout=0.5,recurrent_dropout=0.5,return_sequences=True)))
model.add(Dense(512,activation='relu'))
model.add(Dropout(0.4))
model.add(Dense(32,activation='relu'))
model.add(Dense(n_tags,activation='softmax'))
model.compile(loss="categorical_crossentropy",optimizer="rmsprop",metrics= ["categorical_accuracy"])
model.summary()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)