Skip to content

Key error in predict_salient_mentions.py #13

@viswavi

Description

@viswavi

I trained the baseline SciREX model, and then tried to make predictions for it, but ran into a problem in the step to predict salient mentions. When I tried running:

python scirex/predictors/predict_salient_mentions.py $scirex_archive $test_output_folder/ner_predictions.jsonl $test_output_folder/salient_mentions_predictions.jsonl $cuda_device

I got the error:

  span_ix = span_mask.view(-1).nonzero().squeeze(1).long()
36it [00:02, 15.88it/s]
Traceback (most recent call last):
  File "scirex/predictors/predict_salient_mentions.py", line 92, in <module>
    main()
  File "scirex/predictors/predict_salient_mentions.py", line 88, in main
    predict(archive_folder, test_file, output_file, cuda_device)
  File "scirex/predictors/predict_salient_mentions.py", line 57, in predict
    metadata = output_res['metadata']
KeyError: 'metadata'

It seems that one in every so often, the output of the salient mention prediction decoder is missing the metadata field.

As a stopgap solution, I'm just skipping batches with this issue, but am concerned that I'll accidentally bias my evaluation somehow by doing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions