Hello, Now I have an error when I run the evaluation.py in visualstorytelling section, it seems due to the definition of EncoderOut in visualstorytelling/generator.py which is a namedtuple. error is as follows:
Traceback (most recent call last):
File "evaluation.py", line 169, in <module>
main()
File "evaluation.py", line 165, in main
generate(opt, bart)
File "evaluation.py", line 135, in generate
hypo = generate_sentence(album_id, keywords, model) # keywords 5 ge 809
File "evaluation.py", line 90, in generate_sentence
story = model.generate(cond=feats, keys=keywords, top_k=-1, top_p=0.9)
File "/home/caidesheng/caojie/workspace2/Commonsense-Knowledge-Aware-Concept-Selection-For-Diverse-and-Informative-Visual-Storytelling/visualstorytelling/bart.py", line 109, in generate
'src_lengths': torch.tensor([cond.shape[1]+key_tokens.shape[1]])
File "/home/caidesheng/miniconda3/envs/teran/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/home/caidesheng/caojie/workspace2/Commonsense-Knowledge-Aware-Concept-Selection-For-Diverse-and-Informative-Visual-Storytelling/visualstorytelling/generator.py", line 116, in generate
return self._generate(model, sample, **kwargs)
File "/home/caidesheng/miniconda3/envs/teran/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/home/caidesheng/caojie/workspace2/Commonsense-Knowledge-Aware-Concept-Selection-For-Diverse-and-Informative-Visual-Storytelling/visualstorytelling/generator.py", line 304, in _generate
tokens[:, :step + 1], encoder_outs, temperature=self.temperature,
File "/home/caidesheng/miniconda3/envs/teran/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/home/caidesheng/caojie/workspace2/Commonsense-Knowledge-Aware-Concept-Selection-For-Diverse-and-Informative-Visual-Storytelling/visualstorytelling/generator.py", line 545, in forward_decoder
temperature=temperature,
File "/home/caidesheng/caojie/workspace2/Commonsense-Knowledge-Aware-Concept-Selection-For-Diverse-and-Informative-Visual-Storytelling/visualstorytelling/generator.py", line 577, in _decode_one
if self.incremental_states is not None:
File "/home/caidesheng/.cache/torch/hub/pytorch_fairseq_master/fairseq/models/fairseq_model.py", line 326, in forward_decoder
return self.decoder(prev_output_tokens, **kwargs)
File "/home/caidesheng/miniconda3/envs/teran/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/caidesheng/.cache/torch/hub/pytorch_fairseq_master/fairseq/models/transformer/transformer_decoder.py", line 222, in forward
alignment_heads=alignment_heads,
File "/home/caidesheng/.cache/torch/hub/pytorch_fairseq_master/fairseq/models/transformer/transformer_decoder.py", line 244, in extract_features
alignment_heads,
File "/home/caidesheng/.cache/torch/hub/pytorch_fairseq_master/fairseq/models/transformer/transformer_decoder.py", line 287, in extract_features_scriptable
if encoder_out is not None and len(encoder_out["encoder_out"]) > 0:
TypeError: tuple indices must be integers or slices, not str
Hello, Now I have an error when I run the evaluation.py in visualstorytelling section, it seems due to the definition of EncoderOut in visualstorytelling/generator.py which is a namedtuple. error is as follows: