Closed mklimasz closed 3 years ago
Hi!
You need to generate a different trie. As I showed in https://github.com/facebookresearch/GENRE/tree/main/examples_genre the trie for EL is different from ED. The EL trie does not have root [2]
but it has to start with }
(see below).
prefix_allowed_tokens_fn = get_prefix_allowed_tokens_fn(
model,
sentences,
candidates_trie=Trie([
model.encode(" }} [ {} ]".format(e))[1:].tolist()
for e in ["Albert Einstein", "Nobel Prize in Physics", "NIL"]
])
)
Thus if you want to use the KILT BPE trie you need to generate another one like
kilt_titles = # [<list of all KILT titles>]
new_kilt_trie = Trie([
model.encode(" }} [ {} ]".format(e))[1:].tolist()
for e in kilt_titles + ["NIL"]
])
Hi! First, awesome work on both GENRE and mGENRE :)
I have a trouble using KILT Wikipedia trie in E2E Entity Linking setting. As far as I understand it queries trie here. However, Kilt trie has root node equal to [2], which isn't there. I tried adding it there, but it isn't sufficient. Can you take a look?
Full code below: