Open CallMeNo1 opened 5 years ago
Have you change the crf_only params of add_blstm_crf_layer() to False in create_model func just when you using BLSTM-CRF mode , the crf_only params should be False, not True:
rst = blstm_crf.add_blstm_crf_layer(crf_only=False)
Thx . But I have set the crf_only parm to False before training and got a perfect F1 score. Just during online predict with terminal_predict.py got this error .
Sorry for thie bug, but I do not know how this bug occur right now, After completing my graduation thesis , I will test this bug.
Sorry for thie bug, but I do not know how this bug occur right now, After completing my graduation thesis , I will test this bug.
OK ,could you just tell me where is the problem? I 'll try to debug this . Thx .
the same problem occurs when saving model to pb file:
(/job:localhost/replica:0/task:0/device:GPU:0 with 11417 MB memory) -> physical GPU (device: 0, name: GeForce GTX TITAN X, pci bus id: 0000:03:00.0, compute capability: 5.2) E:NER_MODEL, Lodding...:[gra:opt:306]:fail to optimize the graph! Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that youhave not altered the graph expected based on the checkpoint. Original error:
Assign requires shapes of both tensors to match. lhs shape= [769,4] rhs shape= [896,512]
no one fix this bug?
no one fix this bug?
I fixed this when I rewrite the code part of lstm-cell
when start serving, lstm_size not match. the default value of lstm_size is 128 in the training stage, while the default value of lstm_size is 1 in the predicting stage
I fix this, you all could check pull requests.
the params lstm_size of create_model() function wrong, I fix this bug like this: (total_loss, logits, trans, pred_ids) = create_model( bert_config=bert_config, is_training=False, input_ids=input_ids_p, input_mask=input_mask_p, segment_ids=None, labels=None, num_labels=num_labels, use_one_hot_embeddings=False, dropout_rate=1.0, lstm_size=args.lstm_size, cell=args.cell, num_layers=args.num_layers, crf_only=args.crf_only)
there are two parts of the code needed to modify in lstm_crf_layer.py. Firstly, at 58 row, logits = self.project_bilstm_layer(lstm_output) should be changed to logits = self.project_crf_layer(lstm_output) Secondly, in blstm_layer() function, cell_fw = rnn.MultiRNNCell([cell_fw] self.num_layers, state_is_tuple=True) cell_bw = rnn.MultiRNNCell([cell_bw] self.num_layers, state_is_tuple=True) need to changed to cell_fw = rnn.MultiRNNCell([self._bi_dirrnn()[0] for in range(self.num_layers)], state_is_tuple=True) cell_bw = rnn.MultiRNNCell([self._bi_dirrnn()[1]for in range(self.num_layers)], state_is_tuple=True)
Have you change the crf_only params of add_blstm_crf_layer() to False in create_model func just when you using BLSTM-CRF mode , the crf_only params should be False, not True: