text-summarization-tensorflow
text-summarization-tensorflow copied to clipboard
why there is KeyError: -1 in prediction
when code run here::
prediction_output = [[reversed_dict[y] for y in x] for x in prediction[:, 0, :]]
with open("result.txt", "a") as f:
for line in prediction_output:
summary = list()
for word in line:
if word == "</s>":
break
if word not in summary:
summary.append(word)
print(" ".join(summary), file=f)
print('Summaries are saved to "result.txt"...')
there is error:
KeyError Traceback (most recent call last)
KeyError: -1
Which tensorflow version are you using?
hi @dongjun-Lee thanks for your response, I am using tensorflow==1.4.1. Could you left you email that so I can contact you to ask question, please!
Hi @tianke0711 , it seems the error occurs because of your tensorflow version. Could you please try after upgrading tensorflow to >=1.8? My e-mail is [email protected]. Thank you.
Hi @tianke0711 , it seems the error occurs because of your tensorflow version. Could you please try after upgrading tensorflow to >=1.8? My e-mail is [email protected]. Thank you.
thanks for your kind comments. If I have issues, I will contact you.
I am also getting a similar error
Traceback (most recent call last):
File "test.py", line 36, in <module>
prediction_output = [[reversed_dict[y] for y in x] for x in prediction[:, 0, :]]
File "test.py", line 36, in <listcomp>
prediction_output = [[reversed_dict[y] for y in x] for x in prediction[:, 0, :]]
File "test.py", line 36, in <listcomp>
prediction_output = [[reversed_dict[y] for y in x] for x in prediction[:, 0, :]]
KeyError: -1
Hi @tianke0711 , it seems the error occurs because of your tensorflow version. Could you please try after upgrading tensorflow to >=1.8? My e-mail is [email protected]. Thank you.
thanks for your kind comments. If I have issues, I will contact you.
Has upgrading to a higher version of tensorflow worked?
I am also getting a similar error
Traceback (most recent call last): File "test.py", line 36, in <module> prediction_output = [[reversed_dict[y] for y in x] for x in prediction[:, 0, :]] File "test.py", line 36, in <listcomp> prediction_output = [[reversed_dict[y] for y in x] for x in prediction[:, 0, :]] File "test.py", line 36, in <listcomp> prediction_output = [[reversed_dict[y] for y in x] for x in prediction[:, 0, :]] KeyError: -1
Were you able to resolve the issue? If so, how?