



'''simple docstring'''


from typing import List, Union

import numpy as np

from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, logging
from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline


_lowerCamelCase	:       Optional[Any]      	=	logging.get_logger(__name__)

class  SCREAMING_SNAKE_CASE (  _a		):






    """simple docstring"""





    def  A       (  self      :					int  ,						UpperCamelCase__      :					Tuple ):


       """simple docstring"""







       if isinstance(UpperCamelCase__  ,						UpperCamelCase__ ):
          UpperCamelCase					=  [label.strip() for label in labels.split(',' ) if label.strip()]
       return labels






    def __call__(  self      :					Optional[Any]  ,						UpperCamelCase__      :					Dict  ,						UpperCamelCase__      :					Any  ,						UpperCamelCase__      :					Tuple ):


       """simple docstring"""







       if len(UpperCamelCase__ ) == 0 or len(UpperCamelCase__ ) == 0:
          raise ValueError('You must include at least one label and at least one sequence.' )
       if hypothesis_template.format(labels[0] ) == hypothesis_template:
          raise ValueError(
              (
                  'The provided hypothesis_template "{}" was not able to be formatted with the target labels. '
                  'Make sure the passed template includes formatting syntax such as {{}} where the label should go.'
              ).format(UpperCamelCase__ ) )

       if isinstance(UpperCamelCase__  ,						UpperCamelCase__ ):
          UpperCamelCase					=  [sequences]

       UpperCamelCase					=  []
       for sequence in sequences:
          sequence_pairs.extend([[sequence, hypothesis_template.format(UpperCamelCase__ )] for label in labels] )

       return sequence_pairs, sequences

@add_end_docstrings(_a		)
class  SCREAMING_SNAKE_CASE (  _a		):






    """simple docstring"""





    def __init__(  self      :					Tuple  ,						UpperCamelCase__      :					Any=ZeroShotClassificationArgumentHandler()  ,						*UpperCamelCase__      :					Dict  ,						**UpperCamelCase__      :					str ):


       """simple docstring"""







       UpperCamelCase					=  args_parser
       super().__init__(*UpperCamelCase__  ,						**UpperCamelCase__ )
       if self.entailment_id == -1:
          logger.warning(
              'Failed to determine \'entailment\' label id from the label2id mapping in the model config. Setting to '
              '-1. Define a descriptive label2id mapping in the model config to ensure correct outputs.' )






    @property
    def  A       (  self      :					List[Any] ):


       """simple docstring"""







       for label, ind in self.model.config.labelaid.items():
          if label.lower().startswith('entail' ):
             return ind
       return -1






    def  A       (  self      :					Optional[int]  ,						UpperCamelCase__      :					Dict  ,						UpperCamelCase__      :					Union[str, Any]=True  ,						UpperCamelCase__      :					Tuple=True  ,						UpperCamelCase__      :					Optional[Any]=TruncationStrategy.ONLY_FIRST  ,						**UpperCamelCase__      :					Optional[Any] ):


       """simple docstring"""







       UpperCamelCase					=  self.framework
       if self.tokenizer.pad_token is None:
          # Override for tokenizers not supporting padding
          logger.error(
              'Tokenizer was not supporting padding necessary for zero-shot, attempting to use '
              ' `pad_token=eos_token`' )
          UpperCamelCase					=  self.tokenizer.eos_token
       try:
          UpperCamelCase					=  self.tokenizer(
              UpperCamelCase__  ,						add_special_tokens=UpperCamelCase__  ,						return_tensors=UpperCamelCase__  ,						padding=UpperCamelCase__  ,						truncation=UpperCamelCase__  ,						)
       except Exception as e:
          if "too short" in str(UpperCamelCase__ ):
             # tokenizers might yell that we want to truncate
             # to a value that is not even reached by the input.
             # In that case we don't want to truncate.
             # It seems there's not a really better way to catch that
             # exception.

             UpperCamelCase					=  self.tokenizer(
                 UpperCamelCase__  ,						add_special_tokens=UpperCamelCase__  ,						return_tensors=UpperCamelCase__  ,						padding=UpperCamelCase__  ,						truncation=TruncationStrategy.DO_NOT_TRUNCATE  ,						)
          else:
             raise e

       return inputs






    def  A       (  self      :					Optional[Any]  ,						**UpperCamelCase__      :					List[str] ):


       """simple docstring"""







       if kwargs.get('multi_class'  ,						UpperCamelCase__ ) is not None:
          UpperCamelCase					=  kwargs['multi_class']
          logger.warning(
              'The `multi_class` argument has been deprecated and renamed to `multi_label`. '
              '`multi_class` will be removed in a future version of Transformers.' )
       UpperCamelCase					=  {}
       if "candidate_labels" in kwargs:
          UpperCamelCase					=  self._args_parser._parse_labels(kwargs['candidate_labels'] )
       if "hypothesis_template" in kwargs:
          UpperCamelCase					=  kwargs['hypothesis_template']

       UpperCamelCase					=  {}
       if "multi_label" in kwargs:
          UpperCamelCase					=  kwargs['multi_label']
       return preprocess_params, {}, postprocess_params






    def __call__(  self      :					int  ,						UpperCamelCase__      :					Union[str, List[str]]  ,						*UpperCamelCase__      :					List[Any]  ,						**UpperCamelCase__      :					Any  ,						):


       """simple docstring"""







       if len(UpperCamelCase__ ) == 0:
          pass
       elif len(UpperCamelCase__ ) == 1 and "candidate_labels" not in kwargs:
          UpperCamelCase					=  args[0]
       else:
          raise ValueError(f"""Unable to understand extra arguments {args}""" )

       return super().__call__(UpperCamelCase__  ,						**UpperCamelCase__ )






    def  A       (  self      :					Any  ,						UpperCamelCase__      :					str  ,						UpperCamelCase__      :					Tuple=None  ,						UpperCamelCase__      :					Optional[int]="This example is {}." ):


       """simple docstring"""







       UpperCamelCase				,      UpperCamelCase					=  self._args_parser(UpperCamelCase__  ,						UpperCamelCase__  ,						UpperCamelCase__ )

       for i, (candidate_label, sequence_pair) in enumerate(zip(UpperCamelCase__  ,						UpperCamelCase__ ) ):
          UpperCamelCase					=  self._parse_and_tokenize([sequence_pair] )

          yield {
              "candidate_label": candidate_label,
              "sequence": sequences[0],
              "is_last": i == len(UpperCamelCase__ ) - 1,
              **model_input,
          }






    def  A       (  self      :					Optional[Any]  ,						UpperCamelCase__      :					List[Any] ):


       """simple docstring"""







       UpperCamelCase					=  inputs['candidate_label']
       UpperCamelCase					=  inputs['sequence']
       UpperCamelCase					=  {k: inputs[k] for k in self.tokenizer.model_input_names}
       UpperCamelCase					=  self.model(**UpperCamelCase__ )

       UpperCamelCase					=  {
           'candidate_label': candidate_label,
           'sequence': sequence,
           'is_last': inputs['is_last'],
           **outputs,
       }
       return model_outputs






    def  A       (  self      :					Optional[Any]  ,						UpperCamelCase__      :					Any  ,						UpperCamelCase__      :					Optional[int]=False ):


       """simple docstring"""







       UpperCamelCase					=  [outputs['candidate_label'] for outputs in model_outputs]
       UpperCamelCase					=  [outputs['sequence'] for outputs in model_outputs]
       UpperCamelCase					=  np.concatenate([output['logits'].numpy() for output in model_outputs] )
       UpperCamelCase					=  logits.shape[0]
       UpperCamelCase					=  len(UpperCamelCase__ )
       UpperCamelCase					=  N // n
       UpperCamelCase					=  logits.reshape((num_sequences, n, -1) )

       if multi_label or len(UpperCamelCase__ ) == 1:
          # softmax over the entailment vs. contradiction dim for each label independently
          UpperCamelCase					=  self.entailment_id
          UpperCamelCase					=  -1 if entailment_id == 0 else 0
          UpperCamelCase					=  reshaped_outputs[..., [contradiction_id, entailment_id]]
          UpperCamelCase					=  np.exp(UpperCamelCase__ ) / np.exp(UpperCamelCase__ ).sum(-1  ,						keepdims=UpperCamelCase__ )
          UpperCamelCase					=  scores[..., 1]
       else:
          # softmax the "entailment" logits over all candidate labels
          UpperCamelCase					=  reshaped_outputs[..., self.entailment_id]
          UpperCamelCase					=  np.exp(UpperCamelCase__ ) / np.exp(UpperCamelCase__ ).sum(-1  ,						keepdims=UpperCamelCase__ )

       UpperCamelCase					=  list(reversed(scores[0].argsort() ) )
       return {
           "sequence": sequences[0],
           "labels": [candidate_labels[i] for i in top_inds],
           "scores": scores[0, top_inds].tolist(),
       }



import math





def 			lowerCamelCase_ (				lowerCamelCase__	, lowerCamelCase__    ):
				if 0 not in (x, y):
								# We use the relation x^y = y*log10(x), where 10 is the base.
								return y * math.logaa(lowerCamelCase__    )
				else:
								if x == 0:  # 0 raised to any number is 0
												return 0
								elif y == 0:
												return 1  # any number raised to 0 is 1
				raise AssertionError("This should never happen"    )


if __name__ == "__main__":  # Main function
			# Read two numbers from input and typecast them to int using map function.
			# Here x is the base and y is the power.
			__A				='''Enter the base and the power separated by a comma: '''
			__A,						__A				=map(int, input(prompt).split(''','''))
			__A,						__A				=map(int, input(prompt).split(''','''))

			# We find the log of each number, using the function res(), which takes two
			# arguments.
			__A				=res(xa, ya)
			__A				=res(xa, ya)

			# We check for the largest number
			if resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			elif resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			else:
						print('''Both are equal''')


