ictnlp / TruthX

Code for ACL 2024 paper "TruthX: Alleviating Hallucinations by Editing Large Language Models in Truthful Space"
https://ictnlp.github.io/TruthX-site/
GNU General Public License v3.0
128 stars 6 forks source link

TypeError: LlamaSdpaAttention.forward() got an unexpected keyword argument 'truthx_model' #4

Open Angelo3357 opened 1 month ago

Angelo3357 commented 1 month ago

当我从huggingface上下载模型llama2-7b-chat-truthX后 运行text.py时会出现如下错误,请问该如何解决?

截屏2024-10-18 17 15 38
XavierZhang2002 commented 4 weeks ago

This issue occurs because the "sdpa" method (LlamaSdpaAttention) is being used, and it seems that TruthX does not support this method. Therefore, you can manually set it to "eager" mode (LlamaAttention) as a workaround.