[英]Can someone help me find a solution to error source in my code?
I am training a BI-LSTM-CRF model for a NER task.我正在为 NER 任务训练 BI-LSTM-CRF 模型。 I was able to build the model, but when I fit it with the training data, googlecolab throw me an error.
我能够构建模型,但是当我将它与训练数据进行拟合时,googlecolab 向我抛出了一个错误。
Here is the code for my model below (or here : code for my model ):下面是我的模型的代码(或这里:我的模型的代码):
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()
Then after fitting the model, I get the following error:然后在拟合模型后,我收到以下错误:
AttributeError: 'Tensor' object has no attribute '_keras_history' ([error message for google colab][2])
Here is the list of my dependencies : Dependencies这是我的依赖项列表:依赖项
Can someone help me out?有人可以帮我吗?
I'm not sure what module you're using because you didn't provide any but I'm guessing that's tensorflow
.我不确定您使用的是哪个模块,因为您没有提供任何模块,但我猜那是
tensorflow
。 Try using lower versions of Python like Python 3.7
and also try installing a specific and compatible version: pip install tensorflow==1.13.1
尝试使用
Python 3.7
等较低版本的 Python 并尝试安装特定且兼容的版本: pip install tensorflow==1.13.1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.