

import numpy as np

from transformers import Pipeline
def   a   (    A__			:     List[str]  )					->   int:





      """simple docstring"""



      _lowercase			 =np.max(A__   ,     axis=-1   ,     keepdims=A__  )
      _lowercase			 =np.exp(outputs - maxes  )
      return shifted_exp / shifted_exp.sum(axis=-1   ,     keepdims=A__  )







class 				__lowerCAmelCase  (      SCREAMING_SNAKE_CASE							):




  def 						A__  (       self							,     **lowerCAmelCase      )						->				List[str]:
        '''simple docstring'''






        _lowercase			 ={}
        if "second_text" in kwargs:
              _lowercase			 =kwargs['second_text']
        return preprocess_kwargs, {}, {}




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase=None      )						->				Tuple:
        '''simple docstring'''






        return self.tokenizer(lowerCAmelCase							,     text_pair=lowerCAmelCase							,     return_tensors=self.framework      )




  def 						A__  (       self							,     lowerCAmelCase      )						->				Tuple:
        '''simple docstring'''






        return self.model(**lowerCAmelCase      )




  def 						A__  (       self							,     lowerCAmelCase      )						->				str:
        '''simple docstring'''






        _lowercase			 =model_outputs.logits[0].numpy()
        _lowercase			 =softmax(lowerCAmelCase      )

        _lowercase			 =np.argmax(lowerCAmelCase      )
        _lowercase			 =self.model.config.idalabel[best_class]
        _lowercase			 =probabilities[best_class].item()
        _lowercase			 =logits.tolist()
        return {"label": label, "score": score, "logits": logits}





def   a   (    A__			:     str   ,     A__			:     int  )					->   list[str]:





      """simple docstring"""



      return [sentence[i : i + ngram_size] for i in range(len(A__  ) - ngram_size + 1  )]


if __name__ == "__main__":
  from doctest import testmod

  testmod()


