dmis-lab / BERN2

BERN2: an advanced neural biomedical namedentity recognition and normalization tool
http://bern2.korea.ac.kr
BSD 2-Clause "Simplified" License
175 stars 42 forks source link

Got error when running run_eval.py #51

Closed shorlong closed 1 year ago

shorlong commented 1 year ago

With the model in dmis-lab/bern2-ner, got the following error:

File "/home/BERN2/./multi_ner/training/run_eval.py", line 242, in compute_metrics preds_list, out_label_list = align_predictions(p.predictions, p.label_ids) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/BERN2/./multi_ner/training/run_eval.py", line 226, in align_predictions preds = np.argmax(predictions, axis=2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 3 dimensions. The detected shape was (2, 923, 128) + inhomogeneous part.

Any idea what went wrong? Thanks.

shorlong commented 1 year ago

I was using a higher version of numpy. Can downgrade numpy to 1.23.1 or simply change the code from preds = np.argmax(predictions, axis=2) to preds = np.argmax(predictions[0], axis=2)