thu-coai / Emotional-Support-Conversation

Data and codes for ACL 2021 paper: Towards Emotional Support Dialog Systems
Other
219 stars 32 forks source link

运行interact_strat.sh时,一直提示KeyError: 'strategy'。请求解决谢谢 #18

Closed caoyaru123 closed 1 year ago

caoyaru123 commented 1 year ago

错误如下: 用户无论输入什么,机器都提示策略错误。是找不到策略吗?求作者解答 谢谢 A new conversation starts! Human: hi Traceback (most recent call last): File "/root/Emotional-Support-Conversation-main/codes_zcj/interact.py", line 168, in inputs = inputter.convert_data_to_inputs(history, toker, **dataloader_kwargs) File "/root/Emotional-Support-Conversation-main/codes_zcj/inputters/strat.py", line 87, in convert_data_to_inputs strat_id = process('[' + dialog[i]['strategy'] + ']') KeyError: 'strategy'

chujiezheng commented 1 year ago

可以参见这个issue:https://github.com/thu-coai/Emotional-Support-Conversation/issues/11

caoyaru123 commented 1 year ago

参照11修复了代码,现在又提醒KeyError: tensor(0)。麻烦作者指导一下,谢谢您 image

chujiezheng commented 1 year ago

你这里的strat_id_out是tensor,得转化为int

caoyaru123 commented 1 year ago

应该怎么写呀,能麻烦写一下吗,我写的还是提示不对,谢谢了

chujiezheng commented 1 year ago

strat_id_out.item()

caoyaru123 commented 1 year ago

非常感谢