code: def predict_next_sentence(
      self, sentence_a: str, sentence_b: str
  ) -> float:
      if not self._on_device:
          self.model.to(self.device)
          self._on_device = True
  
      encoded = self.tokenizer(
          sentence_a, sentence_b, return_tensors="pt"
      )
      encoded.to(self.device)
  
      with torch.no_grad():
          scores = self.model(
              encoded["input_ids"],
              token_type_ids=encoded["token_type_ids"],
          ).logits[0]
  
      probabilities = torch.softmax(scores, dim=0)
      # probability that sentence B follows sentence A
      score = probabilities[0].item()
  
      if self.device.type == "cuda":
          torch.cuda.empty_cache()
  
      return score
  
file_path: happy-transformer/happytransformer/happy_next_sentence.py
imports: from typing import Union
  import torch
  from transformers import AutoModelForNextSentencePrediction
  from happytransformer.adaptors import get_adaptor
  from happytransformer.happy_transformer import HappyTransformer
label_desc: Use image node_id 2 for calling the HappyNextSentence obj's underlying member method code with example usage: obj.predict_next_sentence(sentence_a, sentence_b) and returns: score