ML4LitS / annotation_models

Creative Commons Zero v1.0 Universal
0 stars 1 forks source link

Bump `optimum` to 1.16.2 to resolve import error #4

Closed tskir closed 6 months ago

tskir commented 6 months ago

As I was experimenting with the repository, I noticed that installing a blank virtual environment and following the instructions in README leads to:

RuntimeError: Failed to import optimum.onnxruntime.modeling_ort because of the following error (look up to see its traceback):
Failed to import optimum.exporters.onnx.__main__ because of the following error (look up to see its traceback):
cannot import name 'is_torch_less_than_1_11' from 'transformers.pytorch_utils' (/home/ktsukanov/repositories/literature/annotation_models/myenv/lib/python3.10/site-packages/transformers/pytorch_utils.py)

This is because part of the code was recently removed in https://github.com/huggingface/transformers/pull/28207. This has then been addressed in https://github.com/huggingface/optimum/pull/1641, so upgrading to optimum==1.16.2 solves the problem.

tskir commented 6 months ago

P. S. I've checked that after this change the example output isn't materially affected (positions & entities are all the same, confidence scores vary within <0.1%), but of course I couldn't check the entire dataset & performance :upside_down_face:

tsantosh7 commented 6 months ago

Yes I recently noticed this. Totally agree 👍🏽