You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python3 example.py
Traceback (most recent call last):
File "example.py", line 79, in
test_sentence_score()
File "example.py", line 72, in test_sentence_score
mover = sentence_score(sys, refs)
File "example.py", line 23, in sentence_score
scores = word_mover_score(references, hypothesis, idf_dict_ref, idf_dict_hyp, stop_words=[], n_gram=1, remove_subwords=False)
File "/usr/lib/python3.7/site-packages/moverscore_v2.py", line 128, in word_mover_score
device=device)
File "/usr/lib/python3.7/site-packages/moverscore_v2.py", line 100, in get_bert_embedding
batch_embedding = torch.stack(batch_embedding)
TypeError: stack(): argument 'tensors' (position 1) must be tuple of Tensors, not str
The text was updated successfully, but these errors were encountered:
I am having the same error and installing moverscore from the git repo as referred in this #22 (comment) did not work. Can someone please help?
from moverscore_v2 import get_idf_dict, word_mover_score
from collections import defaultdict
Define your texts here
references = ["The quick brown fox jumps over the lazy dog.", "A stitch in time saves nine."]
translations = ["The speedy brown fox leaps over the lazy dog.", "A stitch at the right time saves nine."]
Get IDF dictionaries
idf_dict_hyp = get_idf_dict(translations) # Using default if not specified
idf_dict_ref = get_idf_dict(references) # Using default if not specified
Calculate MoverScore
try:
scores = word_mover_score(references, translations, idf_dict_ref, idf_dict_hyp,
stop_words=[], n_gram=1, remove_subwords=True)
print("Scores:", scores)
except Exception as e:
print("Error during scoring:", str(e))
How to fix the error below? Thank you!
$ python3 example.py
Traceback (most recent call last):
File "example.py", line 79, in
test_sentence_score()
File "example.py", line 72, in test_sentence_score
mover = sentence_score(sys, refs)
File "example.py", line 23, in sentence_score
scores = word_mover_score(references, hypothesis, idf_dict_ref, idf_dict_hyp, stop_words=[], n_gram=1, remove_subwords=False)
File "/usr/lib/python3.7/site-packages/moverscore_v2.py", line 128, in word_mover_score
device=device)
File "/usr/lib/python3.7/site-packages/moverscore_v2.py", line 100, in get_bert_embedding
batch_embedding = torch.stack(batch_embedding)
TypeError: stack(): argument 'tensors' (position 1) must be tuple of Tensors, not str
The text was updated successfully, but these errors were encountered: