wzhouad / ATLOP

Source code for paper "Document-Level Relation Extraction with Adaptive Thresholding and Localized Context Pooling", AAAI 2021
197 stars 39 forks source link

about the labels #22

Closed Amadeus-JD closed 3 years ago

Amadeus-JD commented 3 years ago

I see there a line of code before output the loss that is if labels is not None: labels = [torch.tensor(label) for label in labels] labels = torch.cat(labels, dim=0).to(logits) loss = self.loss_fnt(logits.float(), labels.float()) output = (loss.to(sequence_output),) + output

and i also tried why sometimes the label could be none??? am I got something wrong?

wzhouad commented 3 years ago

The labels can be None in inference.

Amadeus-JD commented 3 years ago

The labels can be None in inference.

不好意思我可以用中文回复吗。。。。请问这个in inferenc是在你们的设想中还是在模型的推理中呢。。 我有print过报错那轮的hts和predict。。显示是有很多需要判断的关系的。。为什么在同一轮label是none呢。。 。。我是想换一个loss试试的。。但是不知道为什么这里label有时候会变成none。。我实验的语料是CDR这种二分类。。 label是none的时候的意思可以理解成那一轮的所有关系都是负例吗?。。。可是集使都是负例应该也是都是【0,1】这种形式吧,,,请问label为none有什么具体含义吗?

sry could i reply you in Chinese? could you tell me this 'in inference' is in your inference or in models'?.. I have printed the hts and logits in that round... it shows many relaitons need to predict and that's what model done...why the label could be none?... Is there any meaning when the label is none? I test your model in CDR dataset,. for those 2-classes classify....is label==none means all hts's label should be negative?.....I think i have some misunstanding.... actually i just want to change a loss type to make absolution experments..

wzhouad commented 3 years ago

None不是代表正负类而是代表ground truth labels是否已知。在模型训练阶段,模型需要拟合训练集上的ground truth label,这个时候labels不是None;在模型测试阶段,ground truth label未知,模型需要预测labels,这个时候labels是None

Amadeus-JD commented 3 years ago

None不是代表正负类而是代表ground truth labels是否已知。在模型训练阶段,模型需要拟合训练集上的ground truth label,这个时候labels不是None;在模型测试阶段,ground truth label未知,模型需要预测labels,这个时候labels是None

谢谢。。。。我重新看了一下代码。。发现了。。你在测试阶段。。。验证集和测试集的label没有传到模型里去。。。 明白了。。谢谢