Comparing probabilities to determine most likely result
Hi,I have two seq_relationship_logits values that have been returned by my NSP model.How can I compare these two logits to find the most likely sentence?Thanks and sorry if this has been asked before!
2022-03-09T17:27:08Z
def predict(main_text, choice_a, choice_b):
    inputs_a = tokenizer(main_text, choice_a,  return_tensors='pt', max_length=512, truncation=True, padding='max_length')    
    inputs_b = tokenizer(main_text, choice_b, return_tensors='pt', max_length=512, truncation=True, padding='max_length')
    outputs_a = model(**inputs_a)    
    outputs_b = model(**inputs_b)

    outputs_a.seq_relationship_logits    
    outputs_b.seq_relationship_logits
    argmax_a = torch.argmax(outputs_a.seq_relationship_logits)  # get index of the max activation
    argmax_b = torch.argmax(outputs_b.seq_relationship_logits)  # get index of the max activation

    print(argmax_a, argmax_b)
2022-03-11T13:55:10Z
you are looking for something like this?How can I use the this result? · Issue #3044 · huggingface/transformers · GitHub