Closed yhcc closed 2 years ago
Hi!
This happens because the span prediction module predicts the same span for different heads. The scorer doesn't like that :)
The quick and hacky workaround will be to modify reference-coreference-scorers/lib/CorScorer.pm and comment out the condition on line 382.
I'll upload a nicer solution soon.
@yhcc
Please, try the following: In coref/conll.py, line 31 change the following loop
for cluster_id, cluster in enumerate(clusters):
for start, end in cluster:
if end - start == 1:
single_word[start].append(cluster_id)
else:
starts[start].append(cluster_id)
ends[end - 1].append(cluster_id)
to be:
predicted_spans = set()
for cluster_id, cluster in enumerate(clusters):
for start, end in cluster:
if (start, end) in predicted_spans:
continue
predicted_spans.add((start, end))
if end - start == 1:
single_word[start].append(cluster_id)
else:
starts[start].append(cluster_id)
ends[end - 1].append(cluster_id)
This is a suboptimal solution, but it will fix your problem. You will need to reevaluate the dev dataset after the fix.
Please let me know how that worked out for you. Thanks for the report!
Thanks for your reply. I will try this revision.
It worked. Thank you very much.
After training, there are a lot of files generated in the
data/conll_logs
folder, their names are likeroberta_dev_e1.gold.conll, roberta_dev_e1.pred.conll
, then I calledpython calculate_conll.py roberta dev 20
to evaluation them, the following errors occuredthen I tried to run evaluation directly throught
perl reference-coreference-scorers/scorer.pl muc data/conll_logs/roberta_dev_e20.gold.conll data/conll_logs/roberta_dev_e20.pred.conll
, then the output is something like the followingthe last line says there are many repeated mentions. Do you have any idea why this is happening?