How to convert single-class BertForSequenceClassification prediction into probability?

  • I am using MS MARCO Cross-Encoders(MS MARCO Cross-Encoders — Sentence-Transformers documentation) to calculate the similarity between two sentences.

  • Looking at the pre-trained model configuration, this is a BertForSequenceClassification.

  • As pointed out by this question(Which loss function in bertforsequenceclassification regression), with single class this model trains as a regression.

  • Currently, my recommendations are coming in a range outside 0…1, for example:

       scores: SequenceClassifierOutput(loss=None, logits=tensor([[-11.3354]]), hidden_states=None, attentions=None)
  • Quesstion: how do I convert this prediction into a probability?