Closed XFR1998 closed 2 years ago
Hi, thanks for using the library.
The mask parameter is to indicate which input tokens are actual words (i.e. not padding/special tokens). So if you have an input of length 3 stored in a tensor of length 5, you should set the mask to be [True, True, True, False, False]
. To use the CRF layer on top of an LSTM, let the LSTM compute the emission score tensor of shape BxNxT, and pass this tensor to the CRF as the emissions
argument. B=batch size, N=sequence length, T=number of tags.
Thanks for your detailed reply.😄
No worries 😄 I assume this is solved so I'm closing the issue.
What is the meaning about the 'mask' parameter of the crf.decode()? Could you provide an example about how to use it? When I combine lstm with crf, how can I do this? Thanks~