patverga / bran

Full abstract relation extraction from biological texts with bi-affine relation attention networks
Apache License 2.0
128 stars 33 forks source link

All candidate pair scores? #4

Open sunilitggu opened 6 years ago

sunilitggu commented 6 years ago

Hi I was trying to understand the code. I found that you are feeding an abstract separately for each candidate pair of the abstract in the model. However, in the paper, it is written once for all candidate pairs.

Am I missing something?

Thanks

patverga commented 6 years ago

Currently the code is doing some redundant computation, re-encoding the abstract for each entity pair. However, it is computing the full pairwise score tensor without any entity pair specific features which you can access here https://github.com/patverga/bran/blob/master/src/models/transformer.py#L468 . You can compute that tensor once and then aggregate scores for each of the entity pairs. This can be done efficiently using a gather/scatter but is not currently implemented.

leebird commented 5 years ago

Hi,

In the above link, a few lines above, it seems e1_mask and e2_mask are not used in any way. How does the model know the locations of the tokens of the current entity pairs?

Thanks!

leebird commented 5 years ago

Ah, never mind, just saw the ep_dist list.

nefujiangping commented 4 years ago

Ah, never mind, just saw the ep_dist list.

Did you know what exactly ep_dist_batch represents? I saw that ep_dist_batch is added to pairwise_scores in code (here) directly.

Thanks!