Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a problem when running run.py #4

Open
li-jing-wen opened this issue Oct 12, 2022 · 1 comment
Open

a problem when running run.py #4

li-jing-wen opened this issue Oct 12, 2022 · 1 comment

Comments

@li-jing-wen
Copy link

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.

@hzhwcmhf
Copy link
Member

@xiaowen3679 Hi, can you try downgrading the nltk to the version 3.4.5? You can use the following commands:

pip install nltk==3.4.5 --force-reinstall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants