allenai / allenai/SciREX

KeyError in Predicting End-to-End relations file

オープン
#17 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
141
フォーク
33
PR マージ指標
30日以内にマージされた PR はありません

説明

I'm running the prediction script and I'm getting a "metadata" KeyError as shown below

```
Traceback (most recent call last):
File "scirex/predictors/predict_n_ary_relations.py", line 109, in
predict(argv[1], argv[2], argv[3], argv[4], int(argv[5]))
File "scirex/predictors/predict_n_ary_relations.py", line 77, in predict
output_res = model.decode_relations(batch)
File ".../SciREX/scirex/models/scirex_model.py", line 385, in decode_relations
res["n_ary_relation"] = self._cluster_n_ary_relation.decode(output_n_ary_relation)
File ".../SciREX/scirex/models/relations/entity_relation.py", line 211, in decode
"metadata" : output_dict['metadata']
KeyError: 'metadata'
```

I went up to the `decode` function in `entity_relation.py`, where I replaced `output_dict['metadata'] ` with `output_dict.get('metadata',[])` For the batches that do not have any spans.

That led to this error occuring:
```
Traceback (most recent call last):
File "scirex/predictors/predict_n_ary_relations.py", line 109, in
predict(argv[1], argv[2], argv[3], argv[4], int(argv[5]))
File "scirex/predictors/predict_n_ary_relations.py", line 82, in predict
metadata = output_res['n_ary_relation']['metadata'][0]
IndexError: list index out of range
```
Returning a default value of `[]` did not seem to do the trick. How can I fix it?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。