ShomyLiu / pytorch-relation-extraction

distant supervised relation extraction models: PCNN MIL (Zeng 2015), PCNN+ATT(Lin 2016). 关系抽取

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexError: too many indices for array

joy19952019 opened this issue · comments

commented

您好,在运行main_mil时出现上述报错,请问该如何解决?
图片

commented

报错位置:
File "main_mil.py", line 136, in select_instance
max_ins_id = max_ins_id.data.numpy()[0]
IndexError: too many indices for array

你好 请检查下python的版本,或者输出下 max_ins_id.data.size()

commented

感谢回复!我的python版本是3.7.6。max_ins_id.data.size()输出结果是torch.Size([])。看起来没有输出结果,那么问题是在这行里吗? max_ins_id = torch.max(out[:, label], 0)[1]

你好,这里建议手动debug下? 您这个问题我这里无法复现哈

我也有这个错误,请问您解决了吗?