pytorch-crf
pytorch-crf copied to clipboard
issues about the parameter "num_tags" of the CRF()?
I would like to know the the parameter "num_tags" of the CRF()?
should the tagset={'O':0, 'B':1, 'I':2, '
because I need to ensure the hidden_size in the fully connected layer follow the lstm
self.fc = nn.Linear(configs.hidden_size*self.num_directions, num_tags)
crf.decode(emissions=lstm_feats, mask=mask_tensor)
Thanks~
Hi, I'm not sure I understand the question. Basically, num_tags
should be set to the size of possible tags for a token. So, if your task is NER with 3 entities: PER, LOC, and ORG, then you'll have 7 tags: O, B-PER, I-PER, B-LOC, I-LOC, B-ORG, and I-ORG. So, you set num_tags=7
. Let me know if you still have questions.