When running run.py, there is an issue IndexError: invalid index to scalar variable. It seems to be the dimension problem of the weights, I don't understand it, may I ask how to solve this problem? The following error message is displayed:
Traceback (most recent call last):
File "/root/nas/NAST/styletransformer/run.py", line 161, in
run(*sys.argv[1:])
File "/root/nas/NAST/styletransformer/run.py", line 157, in run
main(args)
File "/root/nas/NAST/styletransformer/main.py", line 71, in main
model.train_process()
File "/root/nas/NAST/styletransformer/seq2seq.py", line 90, in train_process
devloss_detail = self.evaluate("dev", hasref=False, write_output=False)
File "/root/nas/NAST/styletransformer/seq2seq.py", line 356, in evaluate
result0 = inference(datakey, 0)
File "/root/nas/NAST/styletransformer/seq2seq.py", line 341, in inference
result = metric.close()
File "/opt/conda/envs/torch/lib/python3.9/site-packages/cotk/metric/metric.py", line 242, in close
res.update(metric.close())
File "/root/nas/NAST/styletransformer/../utils/cotk_private/metric/name_changer.py", line 14, in close
return {self.prefix + key: value for key, value in self.target.close().items()}
File "/opt/conda/envs/torch/lib/python3.9/site-packages/cotk/metric/bleu.py", line 189, in close
corpus_bleu(self.refs, self.hyps, weights=weights, smoothing_function=SmoothingFunction().method3), \
File "/opt/conda/envs/torch/lib/python3.9/site-packages/nltk/translate/bleu_score.py", line 200, in corpus_bleu
weights[0][0]
IndexError: invalid index to scalar variable.
When running run.py, there is an issue IndexError: invalid index to scalar variable. It seems to be the dimension problem of the weights, I don't understand it, may I ask how to solve this problem? The following error message is displayed: Traceback (most recent call last): File "/root/nas/NAST/styletransformer/run.py", line 161, in
run(*sys.argv[1:])
File "/root/nas/NAST/styletransformer/run.py", line 157, in run
main(args)
File "/root/nas/NAST/styletransformer/main.py", line 71, in main
model.train_process()
File "/root/nas/NAST/styletransformer/seq2seq.py", line 90, in train_process
devloss_detail = self.evaluate("dev", hasref=False, write_output=False)
File "/root/nas/NAST/styletransformer/seq2seq.py", line 356, in evaluate
result0 = inference(datakey, 0)
File "/root/nas/NAST/styletransformer/seq2seq.py", line 341, in inference
result = metric.close()
File "/opt/conda/envs/torch/lib/python3.9/site-packages/cotk/metric/metric.py", line 242, in close
res.update(metric.close())
File "/root/nas/NAST/styletransformer/../utils/cotk_private/metric/name_changer.py", line 14, in close
return {self.prefix + key: value for key, value in self.target.close().items()}
File "/opt/conda/envs/torch/lib/python3.9/site-packages/cotk/metric/bleu.py", line 189, in close
corpus_bleu(self.refs, self.hyps, weights=weights, smoothing_function=SmoothingFunction().method3), \
File "/opt/conda/envs/torch/lib/python3.9/site-packages/nltk/translate/bleu_score.py", line 200, in corpus_bleu
weights[0][0]
IndexError: invalid index to scalar variable.