VikParuchuri / surya

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

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

Open yy1844 opened 3 hours ago

yy1844 commented 3 hours 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 2 hours 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