I am working on a named entity recognition model using Bi-LTSM CRF.I got a value error while defining the model. The error says (Could not interpret initializer identifier: 14). The code is below.
# Model definition
input = Input(shape=(MAX_LEN,))
model = Embedding(input_dim=n_words+2, output_dim=EMBEDDING, # n_words + 2 (PAD & UNK)
input_length=MAX_LEN, mask_zero=True)(input)
model = Bidirectional(LSTM(units=50, return_sequences=True,
recurrent_dropout=0.1))(model) # variational biLSTM
model = TimeDistributed(Dense(50, activation="relu"))(model) # a dense layer as suggested by neuralNer
crf = CRF(n_tags+1) # CRF layer, n_tags+1(PAD)
out = crf(model) # output
model = Model(input, out)
model.compile(optimizer="rmsprop", loss=crf.loss, metrics=[crf.accuracy])
model.summary()
The is the error message, could you please help me figure out what I am doing wrong here? Thanks.
ValueError Traceback (most recent call last)
<ipython-input-28-d288958649dc> in <module>
6 recurrent_dropout=0.1))(model) # variational biLSTM
7 model = TimeDistributed(Dense(50, activation="relu"))(model) # a dense layer as suggested by neuralNer
----> 8 crf = CRF(n_tags+1) # CRF layer, n_tags+1(PAD)
9 out = crf(model) # output
~\AppData\Local\Continuum\anaconda3\lib\site-packages\tf2crf\crf.py in __init__(self, chain_initializer, **kwargs)
34 def __init__(self, chain_initializer="orthogonal", **kwargs):
35 super(CRF, self).__init__(**kwargs)
---> 36 self.chain_initializer = tf.keras.initializers.get(chain_initializer)
37 self.transitions = None
38 self.supports_masking = True