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

RuntimeError: Sizes of tensors must match except in dimension 0. Got 17 and 13 #24

Open
hoangthangta opened this issue Jun 26, 2022 · 2 comments

Comments

@hoangthangta
Copy link

hoangthangta commented Jun 26, 2022

idf_dict_ref:  defaultdict(<function get_idf_dict.<locals>.<lambda> at 0x7f295995c840>, {1044: 1.540445040947149, 101: 0.0, 102: 0.0, 1045: 1.540445040947149, 1010: 1.9459101490553132, 1049: 1.9459101490553132, 1056: 1.9459101490553132, 1037: 1.9459101490553132, 1050: 1.9459101490553132, 1043: 1.9459101490553132, 1012: 1.9459101490553132})

idf_dict_hyp:  defaultdict(<function get_idf_dict.<locals>.<lambda> at 0x7f2946377730>, {1044: 1.791759469228055, 101: 0.0, 102: 0.0, 1041: 2.1972245773362196, 1048: 1.791759469228055, 1051: 2.1972245773362196, 1045: 2.1972245773362196, 1037: 1.791759469228055, 1049: 2.1972245773362196, 1056: 2.1972245773362196, 1050: 2.1972245773362196, 1043: 2.1972245773362196, 1012: 2.1972245773362196})
............................
    stop_words=[], n_gram=1, remove_subwords=True)
  File "/home/user/.env/lib/python3.6/site-packages/moverscore_v2.py", line 150, in word_mover_score
    raw = torch.cat([ref_embedding, hyp_embedding], 1)
RuntimeError: Sizes of tensors must match except in dimension 0. Got 17 and 13 (The offending index is 0)

I have this error. It seems the size of idf_dict_ref and idf_dict_hyp is not the same?

@vejvarm
Copy link

vejvarm commented Jan 31, 2023

Are your refs and hyps lists the same length when you input it to word_mover_score(refs, hyps, ...)?

@andyweizhao
Copy link
Collaborator

Can you check the format of your input texts? The code supports two evaluation setups: single-ref and multi-ref.
For single-ref, refs and hyps lists have the same length, as each system output is paired with only one reference.

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