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

IndexError occurs when generation #14

Open
ZJUhjx opened this issue Nov 12, 2019 · 4 comments
Open

IndexError occurs when generation #14

ZJUhjx opened this issue Nov 12, 2019 · 4 comments

Comments

@ZJUhjx
Copy link

ZJUhjx commented Nov 12, 2019

When I using your code to run a chinese dataset(the format is the same as wikibio dataset), some error occurs during generation part--"IndexError: index 574664924280828 is out of range for dimension 0 (of size 5)", and I find that it occurs because "maxprobs, top2k = torch.topk(wrd_dist.view(-1), 2 * K)" the top2k are all nan elements. I debug this for a long time but can not solve it, so how can I deal with it?

@ZJUhjx
Copy link
Author

ZJUhjx commented Nov 12, 2019

Traceback (most recent call last):
File "/home/h50001979/.pycharm_helpers/pydev/pydevd.py", line 1758, in
main()
File "/home/h50001979/.pycharm_helpers/pydev/pydevd.py", line 1752, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/h50001979/.pycharm_helpers/pydev/pydevd.py", line 1147, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/h50001979/neural-template-gen/chsmm.py", line 1398, in
gen_from_src()
File "/home/h50001979/neural-template-gen/chsmm.py", line 1312, in gen_from_src
gen_from_srctbl(src_tbl, top_temps, coeffs, src_line=src_line)
File "/home/h50001979/neural-template-gen/chsmm.py", line 1212, in gen_from_srctbl
len_lps, row2tblent, row2feats)
File "/home/h50001979/neural-template-gen/chsmm.py", line 779, in gen_one_ar
args.beamsz, corpus)
File "/home/h50001979/neural-template-gen/chsmm.py", line 691, in temp_ar_bs
nulens[len(new_hyps)][0] = curr_lens[anc][0] + 1

@swiseman
Copy link
Contributor

I you're getting nans, then presumably wrd_dist, which should contain log probabilities, contains nans, so I would recommend trying to figure out how that's happening. Is it possible that somehow you're getting negative numbers on line 507, which become nan after the log on line 513?

@ZJUhjx
Copy link
Author

ZJUhjx commented Nov 14, 2019

Yeah, thanks a lot! You are totally right, I'm getting negative numbers on line 507, which become nan after the log on line 513, but I don't know why this happens =.=. Is there any recommended solution?

@xiaozhi2015
Copy link

@ZJUhjx
How did you turn Chinese dataset to the format same as wikibio. And did you successfully apply this project to Chinese dataset?

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

3 participants