Skip to content

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

@Pppapaya

Description

@Pppapaya

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions