
"""simple docstring"""

import copy
import os
from typing import Union

from ...configuration_utils import PretrainedConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
from ...utils import logging
from ..auto import CONFIG_MAPPING


SCREAMING_SNAKE_CASE_            =    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_            =    {
    '''salesforce/blip2-opt-2.7b''': '''https://huggingface.co/salesforce/blip2-opt-2.7b/resolve/main/config.json''',
}
class   _UpperCAmelCase				(		SCREAMING_SNAKE_CASE_				):
      __SCREAMING_SNAKE_CASE :				List[Any]				   =						"blip_2_vision_model"




      def __init__(				self ,							lowercase_=1_4_0_8 ,							lowercase_=6_1_4_4 ,							lowercase_=3_9 ,							lowercase_=1_6 ,							lowercase_=2_2_4 ,							lowercase_=1_4 ,							lowercase_="gelu" ,							lowercase_=0.0_0_0_0_1 ,							lowercase_=0.0 ,							lowercase_=1E-10 ,							lowercase_=True ,							**lowercase_ ,							)    ->       str:
          super().__init__(**lowercase_				)

          UpperCAmelCase          =       hidden_size
          UpperCAmelCase          =       intermediate_size
          UpperCAmelCase          =       num_hidden_layers
          UpperCAmelCase          =       num_attention_heads
          UpperCAmelCase          =       patch_size
          UpperCAmelCase          =       image_size
          UpperCAmelCase          =       initializer_range
          UpperCAmelCase          =       attention_dropout
          UpperCAmelCase          =       layer_norm_eps
          UpperCAmelCase          =       hidden_act
          UpperCAmelCase          =       qkv_bias




      @classmethod
      def      a_   (				cls ,							lowercase_ ,							**lowercase_				)    ->       "PretrainedConfig":
          cls._set_token_in_kwargs(lowercase_				)

          UpperCAmelCase      ,				UpperCAmelCase          =       cls.get_config_dict(lowercase_ ,							**lowercase_				)

          # get the vision config dict if we are loading from Blip2Config
          if config_dict.get('model_type'				) == "blip-2":
              UpperCAmelCase          =       config_dict['vision_config']

          if "model_type" in config_dict and hasattr(cls ,							'model_type'				) and config_dict["model_type"] != cls.model_type:
              logger.warning(
                  F"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
                  F"{cls.model_type}. This is not supported for all configurations of models and can yield errors."				)

          return cls.from_dict(lowercase_ ,							**lowercase_				)

class   _UpperCAmelCase				(		SCREAMING_SNAKE_CASE_				):
      __SCREAMING_SNAKE_CASE :				str				   =						"blip_2_qformer"




      def __init__(				self ,							lowercase_=3_0_5_2_2 ,							lowercase_=7_6_8 ,							lowercase_=1_2 ,							lowercase_=1_2 ,							lowercase_=3_0_7_2 ,							lowercase_="gelu" ,							lowercase_=0.1 ,							lowercase_=0.1 ,							lowercase_=5_1_2 ,							lowercase_=0.0_2 ,							lowercase_=1E-12 ,							lowercase_=0 ,							lowercase_="absolute" ,							lowercase_=2 ,							lowercase_=1_4_0_8 ,							**lowercase_ ,							)    ->       Any:
          super().__init__(pad_token_id=lowercase_ ,							**lowercase_				)

          UpperCAmelCase          =       vocab_size
          UpperCAmelCase          =       hidden_size
          UpperCAmelCase          =       num_hidden_layers
          UpperCAmelCase          =       num_attention_heads
          UpperCAmelCase          =       hidden_act
          UpperCAmelCase          =       intermediate_size
          UpperCAmelCase          =       hidden_dropout_prob
          UpperCAmelCase          =       attention_probs_dropout_prob
          UpperCAmelCase          =       max_position_embeddings
          UpperCAmelCase          =       initializer_range
          UpperCAmelCase          =       layer_norm_eps
          UpperCAmelCase          =       position_embedding_type
          UpperCAmelCase          =       cross_attention_frequency
          UpperCAmelCase          =       encoder_hidden_size




      @classmethod
      def      a_   (				cls ,							lowercase_ ,							**lowercase_				)    ->       "PretrainedConfig":
          cls._set_token_in_kwargs(lowercase_				)

          UpperCAmelCase      ,				UpperCAmelCase          =       cls.get_config_dict(lowercase_ ,							**lowercase_				)

          # get the qformer config dict if we are loading from Blip2Config
          if config_dict.get('model_type'				) == "blip-2":
              UpperCAmelCase          =       config_dict['qformer_config']

          if "model_type" in config_dict and hasattr(cls ,							'model_type'				) and config_dict["model_type"] != cls.model_type:
              logger.warning(
                  F"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
                  F"{cls.model_type}. This is not supported for all configurations of models and can yield errors."				)

          return cls.from_dict(lowercase_ ,							**lowercase_				)

class   _UpperCAmelCase				(		SCREAMING_SNAKE_CASE_				):
      __SCREAMING_SNAKE_CASE :				Optional[int]				   =						"blip-2"
      __SCREAMING_SNAKE_CASE :				Optional[Any]				   =						True




      def __init__(				self ,							lowercase_=None ,							lowercase_=None ,							lowercase_=None ,							lowercase_=3_2 ,							**lowercase_				)    ->       List[str]:
          super().__init__(**lowercase_				)

          if vision_config is None:
              UpperCAmelCase          =       {}
              logger.info('vision_config is None. initializing the Blip2VisionConfig with default values.'				)

          if qformer_config is None:
              UpperCAmelCase          =       {}
              logger.info('qformer_config is None. Initializing the Blip2QFormerConfig with default values.'				)

          if text_config is None:
              UpperCAmelCase          =       {}
              logger.info('text_config is None. Initializing the text config with default values (`OPTConfig`).'				)

          UpperCAmelCase          =       BlipaVisionConfig(**lowercase_				)
          UpperCAmelCase          =       BlipaQFormerConfig(**lowercase_				)
          UpperCAmelCase          =       text_config['model_type'] if 'model_type' in text_config else 'opt'
          UpperCAmelCase          =       CONFIG_MAPPING[text_model_type](**lowercase_				)

          UpperCAmelCase          =       self.text_config.tie_word_embeddings
          UpperCAmelCase          =       self.text_config.is_encoder_decoder

          UpperCAmelCase          =       num_query_tokens
          UpperCAmelCase          =       self.vision_config.hidden_size
          UpperCAmelCase          =       self.text_config.model_type in MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
          UpperCAmelCase          =       1.0
          UpperCAmelCase          =       0.0_2




      @classmethod
      def      a_   (				cls ,							lowercase_ ,							lowercase_ ,							lowercase_ ,							**lowercase_ ,							)    ->       Optional[int]:
          return cls(
              vision_config=vision_config.to_dict() ,							qformer_config=qformer_config.to_dict() ,							text_config=text_config.to_dict() ,							**lowercase_ ,							)




      def      a_   (				self				)    ->       List[Any]:
          UpperCAmelCase          =       copy.deepcopy(self.__dict__				)
          UpperCAmelCase          =       self.vision_config.to_dict()
          UpperCAmelCase          =       self.qformer_config.to_dict()
          UpperCAmelCase          =       self.text_config.to_dict()
          UpperCAmelCase          =       self.__class__.model_type
          return output





"""simple docstring"""

import math




def      lowercase__    (       lowerCAmelCase					:       str			,					lowerCAmelCase					:       Optional[Any]			)			->   List[Any]:






    """simple docstring"""




    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.
   SCREAMING_SNAKE_CASE_            =    '''Enter the base and the power separated by a comma: '''
   SCREAMING_SNAKE_CASE_       ,    SCREAMING_SNAKE_CASE_            =    map(int, input(prompt).split(''','''))
   SCREAMING_SNAKE_CASE_       ,    SCREAMING_SNAKE_CASE_            =    map(int, input(prompt).split(''','''))

   # We find the log of each number, using the function res(), which takes two
   # arguments.
   SCREAMING_SNAKE_CASE_            =    res(xa, ya)
   SCREAMING_SNAKE_CASE_            =    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''')



