Got error when running run_eval.py
shorlong opened this issue · 1 comments
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.
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)