Pgibby8 / SentenceFusion

0 stars 0 forks source link

RuntimeError: probability tensor contains either `inf`, `nan` or element < 0 #5

Open Pppapaya opened 1 year ago

Pppapaya commented 1 year ago

Hi, thank you for sharing such impressive work. I'm new for this topic. I met a problem when I try to run the code. I wrote the test code as you guided, showing as follows:

from transformers import BertTokenizer, EncoderDecoderModel from SentenceFusion import sentence_fusion as sf

bert2bert = EncoderDecoderModel.from_pretrained('ralcanta/do_nothing_bert') tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

fuser = sf.SentenceFusion(tokenizer, bert2bert)

primary_sentence = "cables on a table" secondary_sentence = "a laptop on a table" fuser.fuse(primary_sentence, secondary_sentence, delta=.5)

But when I run it, it reported, RuntimeError: probability tensor contains either inf, nan or element < 0, would you mind helping me fix it? Looking forward to your reply. Thank you.

Pppapaya commented 1 year ago

And my transformer==4.15.0, torch==1.13.0, numpy==1.21.6