[英]Can someone help me find a solution to error source in my code?
我正在為 NER 任務訓練 BI-LSTM-CRF 模型。 我能夠構建模型,但是當我將它與訓練數據進行擬合時,googlecolab 向我拋出了一個錯誤。
下面是我的模型的代碼(或這里:我的模型的代碼):
input_layer = layers.Input(shape=(MAX_SENTENCE,))
model = layers.Embedding(WORD_COUNT, DENSE_EMBEDDING, embeddings_initializer="uniform", input_length=MAX_SENTENCE)(input_layer)
model = layers.Bidirectional(layers.LSTM(LSTM_UNITS, recurrent_dropout=LSTM_DROPOUT, return_sequences=True))(model)
model = layers.TimeDistributed(layers.Dense(DENSE_UNITS, activation="relu"))(model)
crf_layer = CRF(units=TAG_COUNT)
output_layer = crf_layer(model)
ner_model = Model(input_layer, output_layer)
loss = losses.crf_loss
acc_metric = metrics.crf_accuracy
opt = tf.keras.optimizers.Adam(learning_rate=0.001)
ner_model.compile(optimizer=opt, loss=loss, metrics=[acc_metric])
ner_model.summary()
然后在擬合模型后,我收到以下錯誤:
AttributeError: 'Tensor' object has no attribute '_keras_history' ([error message for google colab][2])
這是我的依賴項列表:依賴項
有人可以幫我嗎?
我不確定您使用的是哪個模塊,因為您沒有提供任何模塊,但我猜那是tensorflow
。 嘗試使用Python 3.7
等較低版本的 Python 並嘗試安裝特定且兼容的版本: pip install tensorflow==1.13.1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.