





import numpy as np

from transformers import Pipeline



def 				lowerCAmelCase_ (							A_):
    UpperCamelCase__:	List[Any]					=     np.max(A_    ,axis=-1    ,keepdims=A_)
    UpperCamelCase__:	str					=     np.exp(outputs - maxes)
    return shifted_exp / shifted_exp.sum(axis=-1    ,keepdims=A_)




class        _a    (    UpperCamelCase__):

      """simple docstring"""


      def 			UpperCAmelCase_       (		self:			Tuple	,    **__lowerCamelCase:			Optional[int]					):
          '''simple docstring'''


          UpperCamelCase__:	List[str]					=     {}
          if "second_text" in kwargs:
              UpperCamelCase__:	Optional[Any]					=     kwargs["second_text"]
          return preprocess_kwargs, {}, {}






      def 			UpperCAmelCase_       (		self:			List[str]	,    __lowerCamelCase:			str	,    __lowerCamelCase:			Dict=None					):
          '''simple docstring'''


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






      def 			UpperCAmelCase_       (		self:			Any	,    __lowerCamelCase:			Dict					):
          '''simple docstring'''


          return self.model(**__lowerCamelCase					)






      def 			UpperCAmelCase_       (		self:			Dict	,    __lowerCamelCase:			str					):
          '''simple docstring'''


          UpperCamelCase__:	Optional[int]					=     model_outputs.logits[0].numpy()
          UpperCamelCase__:	List[Any]					=     softmax(__lowerCamelCase					)

          UpperCamelCase__:	Dict					=     np.argmax(__lowerCamelCase					)
          UpperCamelCase__:	List[Any]					=     self.model.config.idalabel[best_class]
          UpperCamelCase__:	Dict					=     probabilities[best_class].item()
          UpperCamelCase__:	List[str]					=     logits.tolist()
          return {"label": label, "score": score, "logits": logits}








from typing import TYPE_CHECKING

from ...file_utils import _LazyModule, is_torch_available
from ...utils import OptionalDependencyNotAvailable


A__:    Any  	=	{
    '''configuration_gpt_neox_japanese''': ['''GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXJapaneseConfig'''],
    '''tokenization_gpt_neox_japanese''': ['''GPTNeoXJapaneseTokenizer'''],
}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A__:    Union[str, Any]  	=	[
       '''GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''GPTNeoXJapaneseForCausalLM''',
       '''GPTNeoXJapaneseLayer''',
       '''GPTNeoXJapaneseModel''',
       '''GPTNeoXJapanesePreTrainedModel''',
   ]


if TYPE_CHECKING:
   from .configuration_gpt_neox_japanese import GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTNeoXJapaneseConfig
   from .tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_gpt_neox_japanese import (
          GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST,
          GPTNeoXJapaneseForCausalLM,
          GPTNeoXJapaneseLayer,
          GPTNeoXJapaneseModel,
          GPTNeoXJapanesePreTrainedModel,
      )


else:
   import sys

   A__:    str  	=	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

