Error when executing cnnatt.py and pcnnatt.py
tpof314 opened this issue · comments
Huang Haojie commented
I got the following error when running cnnatt.py
and pcnnatt.py
.
File "pcnnatt.py", line 332, in <module>
model.fit(sess)
File "/home/haojie/projects/RESIDE/base.py", line 498, in fit
one_100, one_200, one_300 = self.getPscore(sess, self.test_one, label='P@1 Evaluation')
File "/home/haojie/projects/RESIDE/base.py", line 432, in getPscore
test_loss, test_acc, y, y_pred, logit_list, y_hot = self.predict(sess, data, label)
File "/home/haojie/projects/RESIDE/base.py", line 326, in predict
for step, batch in enumerate(self.getBatches(data, shuffle)):
File "pcnnatt.py", line 55, in getBatches
batch['PartPos'] += get_sent_part(bag['SubPos'], bag['ObjPos'], bag['X'])
KeyError: 'SubPos'
I find that in base.py
, when creating the p_one
and p_two
lists, neitherSubPos
nor ObjPos
are added to the new dictionary.
p_one.append({
'X': [bag['X'][indx[0]]],
'Pos1': [bag['Pos1'][indx[0]]],
'Pos2': [bag['Pos2'][indx[0]]],
'DepEdges': [bag['DepEdges'][indx[0]]],
'ProbY': [bag['ProbY'][indx[0]]],
'Y': bag['Y'],
'SubType': bag['SubType'],
'ObjType': bag['ObjType']
})
Could you please fix this bug? Thanks!
Shikhar Vashishth commented
Hi,
Can you try replacing 'SubPos' with 'Pos1' and 'ObjPos' with 'Pos2' and check things once again?
buluxianfeng commented
batch['PartPos'] += get_sent_part(bag['SubPos'], bag['ObjPos'], bag['X'])
change this line to:
batch['PartPos'] += get_sent_part(bag['SubPos'], bag['ObjPos'], bag['X'])
I hope this can help you!