ConvLab-2
ConvLab-2 copied to clipboard
BERTNLU postprocess.py 为什么可以通过 if intent_logits[j] > 0: 来获得intent的预测呢?
for j in range(dataloader.intent_dim):
if intent_logits[j] > 0:
intent, domain, slot, value = re.split('\+', dataloader.id2intent[j])
das.append([intent, domain, slot, value])
Sorry for the late reply. intent_logits are the logits before sigmoid layer, since BCEWithLogitsLoss combines a Sigmoid layer and the BCELoss in one single class. Therefore, the logit>0 means output after sigmoid is larger than 0.5. https://github.com/thu-coai/ConvLab-2/blob/ad32b76022fa29cbc2f24cbefbb855b60492985e/convlab2/nlu/jointBERT/jointBERT.py#L44