

import copy
import os
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union


if TYPE_CHECKING:
      from ...processing_utils import ProcessorMixin
      from ...utils import TensorType

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


a_    :						str    		=      logging.get_logger(__name__)

a_    :						List[Any]    		=      {
    "google/owlvit-base-patch32": "https://huggingface.co/google/owlvit-base-patch32/resolve/main/config.json",
    "google/owlvit-base-patch16": "https://huggingface.co/google/owlvit-base-patch16/resolve/main/config.json",
    "google/owlvit-large-patch14": "https://huggingface.co/google/owlvit-large-patch14/resolve/main/config.json",
}




class      UpperCamelCase (     SCREAMING_SNAKE_CASE   ):
    __UpperCamelCase         ="owlvit_text_model"

    def __init__(			self :      int							,    snake_case__ :      int=4_9_4_0_8							,    snake_case__ :      str=5_1_2							,    snake_case__ :      str=2_0_4_8							,    snake_case__ :      Optional[Any]=1_2							,    snake_case__ :      List[Any]=8							,    snake_case__ :      str=1_6							,    snake_case__ :      int="quick_gelu"							,    snake_case__ :      int=1E-5							,    snake_case__ :      Union[str, Any]=0.0							,    snake_case__ :      List[Any]=0.02							,    snake_case__ :      Optional[Any]=1.0							,    snake_case__ :      Optional[int]=0							,    snake_case__ :      Any=4_9_4_0_6							,    snake_case__ :      str=4_9_4_0_7							,    **snake_case__ :      Any							,    ):

     """simple docstring"""






     super().__init__(pad_token_id=snake_case__							,    bos_token_id=snake_case__							,    eos_token_id=snake_case__							,    **snake_case__    )

     SCREAMING_SNAKE_CASE								=			vocab_size
     SCREAMING_SNAKE_CASE								=			hidden_size
     SCREAMING_SNAKE_CASE								=			intermediate_size
     SCREAMING_SNAKE_CASE								=			num_hidden_layers
     SCREAMING_SNAKE_CASE								=			num_attention_heads
     SCREAMING_SNAKE_CASE								=			max_position_embeddings
     SCREAMING_SNAKE_CASE								=			hidden_act
     SCREAMING_SNAKE_CASE								=			layer_norm_eps
     SCREAMING_SNAKE_CASE								=			attention_dropout
     SCREAMING_SNAKE_CASE								=			initializer_range
     SCREAMING_SNAKE_CASE								=			initializer_factor




    @classmethod
    def UpperCamelCase			(			cls :      List[str]							,    snake_case__ :      Union[str, os.PathLike]							,    **snake_case__ :      str    ):

     """simple docstring"""






     cls._set_token_in_kwargs(snake_case__    )

     SCREAMING_SNAKE_CASE						,	SCREAMING_SNAKE_CASE								=			cls.get_config_dict(snake_case__							,    **snake_case__    )

     # get the text config dict if we are loading from OwlViTConfig
     if config_dict.get('model_type'    ) == "owlvit":
      SCREAMING_SNAKE_CASE								=			config_dict['text_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(snake_case__							,    **snake_case__    )




class      UpperCamelCase (     SCREAMING_SNAKE_CASE   ):
    __UpperCamelCase         ="owlvit_vision_model"

    def __init__(			self :      List[str]							,    snake_case__ :      str=7_6_8							,    snake_case__ :      Any=3_0_7_2							,    snake_case__ :      str=1_2							,    snake_case__ :      Union[str, Any]=1_2							,    snake_case__ :      Dict=3							,    snake_case__ :      Dict=7_6_8							,    snake_case__ :      Dict=3_2							,    snake_case__ :      str="quick_gelu"							,    snake_case__ :      Optional[int]=1E-5							,    snake_case__ :      Union[str, Any]=0.0							,    snake_case__ :      Any=0.02							,    snake_case__ :      Optional[int]=1.0							,    **snake_case__ :      int							,    ):

     """simple docstring"""






     super().__init__(**snake_case__    )

     SCREAMING_SNAKE_CASE								=			hidden_size
     SCREAMING_SNAKE_CASE								=			intermediate_size
     SCREAMING_SNAKE_CASE								=			num_hidden_layers
     SCREAMING_SNAKE_CASE								=			num_attention_heads
     SCREAMING_SNAKE_CASE								=			num_channels
     SCREAMING_SNAKE_CASE								=			image_size
     SCREAMING_SNAKE_CASE								=			patch_size
     SCREAMING_SNAKE_CASE								=			hidden_act
     SCREAMING_SNAKE_CASE								=			layer_norm_eps
     SCREAMING_SNAKE_CASE								=			attention_dropout
     SCREAMING_SNAKE_CASE								=			initializer_range
     SCREAMING_SNAKE_CASE								=			initializer_factor




    @classmethod
    def UpperCamelCase			(			cls :      Any							,    snake_case__ :      Union[str, os.PathLike]							,    **snake_case__ :      Union[str, Any]    ):

     """simple docstring"""






     cls._set_token_in_kwargs(snake_case__    )

     SCREAMING_SNAKE_CASE						,	SCREAMING_SNAKE_CASE								=			cls.get_config_dict(snake_case__							,    **snake_case__    )

     # get the vision config dict if we are loading from OwlViTConfig
     if config_dict.get('model_type'    ) == "owlvit":
      SCREAMING_SNAKE_CASE								=			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(snake_case__							,    **snake_case__    )




class      UpperCamelCase (     SCREAMING_SNAKE_CASE   ):
    __UpperCamelCase         ="owlvit"
    __UpperCamelCase         =True

    def __init__(			self :      Union[str, Any]							,    snake_case__ :      int=None							,    snake_case__ :      str=None							,    snake_case__ :      Dict=5_1_2							,    snake_case__ :      int=2.6_592							,    snake_case__ :      Optional[Any]=True							,    **snake_case__ :      Any							,    ):

     """simple docstring"""






     super().__init__(**snake_case__    )

     if text_config is None:
      SCREAMING_SNAKE_CASE								=			{}
      logger.info('text_config is None. Initializing the OwlViTTextConfig with default values.'    )

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

     SCREAMING_SNAKE_CASE								=			OwlViTTextConfig(**snake_case__    )
     SCREAMING_SNAKE_CASE								=			OwlViTVisionConfig(**snake_case__    )

     SCREAMING_SNAKE_CASE								=			projection_dim
     SCREAMING_SNAKE_CASE								=			logit_scale_init_value
     SCREAMING_SNAKE_CASE								=			return_dict
     SCREAMING_SNAKE_CASE								=			1.0

    @classmethod
    def UpperCamelCase			(			cls :      str							,    snake_case__ :      Union[str, os.PathLike]							,    **snake_case__ :      List[str]    ):

     """simple docstring"""






     cls._set_token_in_kwargs(snake_case__    )

     SCREAMING_SNAKE_CASE						,	SCREAMING_SNAKE_CASE								=			cls.get_config_dict(snake_case__							,    **snake_case__    )

     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(snake_case__							,    **snake_case__    )

    @classmethod
    def UpperCamelCase			(			cls :      str							,    snake_case__ :      Dict							,    snake_case__ :      Dict							,    **snake_case__ :      Union[str, Any]    ):

     """simple docstring"""






     SCREAMING_SNAKE_CASE								=			{}
     SCREAMING_SNAKE_CASE								=			text_config
     SCREAMING_SNAKE_CASE								=			vision_config

     return cls.from_dict(snake_case__							,    **snake_case__    )




    def UpperCamelCase			(			self :      Dict    ):

     """simple docstring"""






     SCREAMING_SNAKE_CASE								=			copy.deepcopy(self.__dict__    )
     SCREAMING_SNAKE_CASE								=			self.text_config.to_dict()
     SCREAMING_SNAKE_CASE								=			self.vision_config.to_dict()
     SCREAMING_SNAKE_CASE								=			self.__class__.model_type
     return output




class      UpperCamelCase (     SCREAMING_SNAKE_CASE   ):

    @property
    def UpperCamelCase			(			self :      Any    ):

     """simple docstring"""






     return OrderedDict(
         [
             ('input_ids', {0: 'batch', 1: 'sequence'}),
             ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
             ('attention_mask', {0: 'batch', 1: 'sequence'}),
         ]    )

    @property
    def UpperCamelCase			(			self :      Optional[Any]    ):

     """simple docstring"""






     return OrderedDict(
         [
             ('logits_per_image', {0: 'batch'}),
             ('logits_per_text', {0: 'batch'}),
             ('text_embeds', {0: 'batch'}),
             ('image_embeds', {0: 'batch'}),
         ]    )

    @property
    def UpperCamelCase			(			self :      List[str]    ):

     """simple docstring"""






     return 1E-4

    def UpperCamelCase			(			self :      int							,    snake_case__ :      "ProcessorMixin"							,    snake_case__ :      int = -1							,    snake_case__ :      int = -1							,    snake_case__ :      Optional["TensorType"] = None							,    ):

     """simple docstring"""






     SCREAMING_SNAKE_CASE								=			super().generate_dummy_inputs(
         processor.tokenizer							,    batch_size=snake_case__							,    seq_length=snake_case__							,    framework=snake_case__    )
     SCREAMING_SNAKE_CASE								=			super().generate_dummy_inputs(
         processor.image_processor							,    batch_size=snake_case__							,    framework=snake_case__    )
     return {**text_input_dict, **image_input_dict}




    @property
    def UpperCamelCase			(			self :      Any    ):

     """simple docstring"""






     return 1_4







def        __lowerCAmelCase    (       _UpperCamelCase		:  int = 10_00	)		->							int:
 '''simple docstring'''


 SCREAMING_SNAKE_CASE								=			2**power
 SCREAMING_SNAKE_CASE								=			str(_UpperCamelCase	)
 SCREAMING_SNAKE_CASE								=			list(_UpperCamelCase	)
 SCREAMING_SNAKE_CASE								=			0

 for i in list_num:
  sum_of_num += int(_UpperCamelCase	)

 return sum_of_num


if __name__ == "__main__":
      a_    :						List[str]    		=      int(input("Enter the power of 2: ").strip())
      print("2 ^ ", power, " = ", 2**power)
      a_    :						int    		=      solution(power)
      print("Sum of the digits is: ", result)

