Open ndgnuh opened 2 years ago
Hi, thank you for sharing your code. As we noted in the paper, the SPADE decoder implementation in this repo is slightly different from the original paper.
Well, I can't say which one is "more correct" since I'm not the author. I just want to note that the implementation in this repository can produce very large logits, so the use of threshold (0.5
as in the paper) might not work for sparse label.
I find the implementation of
RelationExtractor
in this repository is incorrect (according to the original one). I'm aware that the implementation is (kind of) the same as the one 2005.00642. But after digging up the code in clovaai/spade, I realized the original implementation is different from the paper. I'll refer to the implementation as SPADE, this repository as BROS and the paper as SPADE paper.My version of
RelationExtractor
(which have been tested and able to achieve somewhat equivalent results of the original SPADE):This implementation works for single relation, but one can use multiple instances of this layer for multiple relations. The output dim is
b * s * (n+f) * n
, whereb
is batch size,s = 2
ands
is the number of score matrices,n
is sequence length, andf
is the number of fields. The final relation matrices is obtained byscore.argmax(dim=1)
.