VikParuchuri / surya

OCR, layout analysis, reading order, table recognition in 90+ languages
https://www.datalab.to
GNU General Public License v3.0
14.35k stars 899 forks source link

KeyError: 'sdpa' 问题和兼容性错误 #224

Closed yy1844 closed 1 month ago

yy1844 commented 1 month ago

在本地运行 surya_gui 时,我遇到了以下报错。Streamlit 正常启动,但加载模型时报 KeyError: 'sdpa'。具体错误信息如下:

环境: Windows 11 Python 3.12.6 Transformers 4.46.0 Torch 2.5.0+cu118 Surya-ocr 0.6.10

KeyError: 'sdpa' ... File "surya\model\ordering\decoder.py", line 209, in init self.self_attn = MBART_ATTENTION_CLASSES[config._attn_implementation]

cweisenborn commented 1 month ago

I ran into this same issue. It worked on a different machine yesterday but won't work today. It seems that the pypi transformers package was updated to 4.46.0 overnight and is causing issues. Manually installing 4.45.2 worked for me.

pip install transformers==4.45.2

VikParuchuri commented 1 month ago

This is a bug with transformers 4.46 - will fix today

yy1844 commented 1 month ago

邮件已收到,谢谢!

VikParuchuri commented 1 month ago

Fixed in latest