Closed xashru closed 4 years ago
This was caused by a bug in my code when calculating the result. This issue can be deleted.
Hi! I also encountered the similar issue as the one you mentioned, could you please tell somethings more details of how you fix the bug? Thanks a lot.
Hi, I am using pytorch-crf for token prediction task with a LSTM network. When I use a fully connected layer after lstm it works fine.
This is trained using
nn.CrossEntropyLoss
loss in PyTorch.Now, I want to add a CRF layer for a sequence prediction task.
-crf_out
is used as loss to train the network. Decoding is done usingdec_out = self.crf.decode(x, masks)
However, this only predicts one category (which hast the maximum occurrence in the data). Perhaps I should mention that the dataset is heavily imbalanced and one target token consists of 85% of all tokens. Loss decreases during training.