sayef / fsner

Few-shot Named Entity Recognition
119 stars 6 forks source link

Multiple distinct sentences as a query. #7

Open dnanad opened 2 years ago

dnanad commented 2 years ago

Hi!

I saw some of the other issues. Also, tried the following what you recommended:

`W_supports = tokenizer.tokenize(supports).to(device) n = len(supports)

for q in query: W_query = tokenizer.tokenize([q]*n).to(device) start_prob, end_prob = model(W_query, W_supports) print(W_query) output = tokenizer.extract_entity_from_scores(query, W_query, start_prob, end_prob, thresh=0.50) print(output)`

But at the second iteration only i am getting KeyError: 'sizes'.

I tried separately for the query, by first creating [q]*n then doing the rest. It works fine, but not in this for loop.

sayef commented 2 years ago

@dnanad Hi could you please try with the latest version (fsner==0.1.1) the issue should be resolved with latest fixes. Also don't forget that each example sentence should not contain more than one pair of [E]...[/E]. Also there is a data preparation section on the readme. I hope this would help.