
'''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


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

__lowercase							:   List[str]					=     {
    '''Salesforce/instruct-blip-flan-t5''': '''https://huggingface.co/Salesforce/instruct-blip-flan-t5/resolve/main/config.json''',
}

class 	__lowercase				(  _lowercase    ):
			lowerCamelCase			:		List[Any]	      =			"instructblip_vision_model"

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

								lowerCamelCase_					:      List[Any]     =		hidden_size
								lowerCamelCase_					:      Any     =		intermediate_size
								lowerCamelCase_					:      Any     =		num_hidden_layers
								lowerCamelCase_					:      str     =		num_attention_heads
								lowerCamelCase_					:      List[str]     =		patch_size
								lowerCamelCase_					:      Optional[Any]     =		image_size
								lowerCamelCase_					:      Any     =		initializer_range
								lowerCamelCase_					:      Tuple     =		attention_dropout
								lowerCamelCase_					:      str     =		layer_norm_eps
								lowerCamelCase_					:      List[Any]     =		hidden_act
								lowerCamelCase_					:      List[str]     =		qkv_bias






			@classmethod
			def        UpperCAmelCase__ (cls			,   A			,   **A      ):
								cls._set_token_in_kwargs(A      )

								lowerCamelCase_,      lowerCamelCase_					:      int     =		cls.get_config_dict(A			,   **A      )

								# get the vision config dict if we are loading from InstructBlipConfig
								if config_dict.get('''model_type'''      ) == "instructblip":
													lowerCamelCase_					:      List[str]     =		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(A			,   **A      )

class 	__lowercase				(  _lowercase    ):
			lowerCamelCase			:		List[str]	      =			"instructblip_qformer"

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

								lowerCamelCase_					:      Dict     =		vocab_size
								lowerCamelCase_					:      int     =		hidden_size
								lowerCamelCase_					:      Union[str, Any]     =		num_hidden_layers
								lowerCamelCase_					:      Optional[Any]     =		num_attention_heads
								lowerCamelCase_					:      Union[str, Any]     =		hidden_act
								lowerCamelCase_					:      Optional[Any]     =		intermediate_size
								lowerCamelCase_					:      List[str]     =		hidden_dropout_prob
								lowerCamelCase_					:      Any     =		attention_probs_dropout_prob
								lowerCamelCase_					:      Optional[int]     =		max_position_embeddings
								lowerCamelCase_					:      Any     =		initializer_range
								lowerCamelCase_					:      Tuple     =		layer_norm_eps
								lowerCamelCase_					:      Optional[int]     =		position_embedding_type
								lowerCamelCase_					:      int     =		cross_attention_frequency
								lowerCamelCase_					:      Tuple     =		encoder_hidden_size






			@classmethod
			def        UpperCAmelCase__ (cls			,   A			,   **A      ):
								cls._set_token_in_kwargs(A      )

								lowerCamelCase_,      lowerCamelCase_					:      List[Any]     =		cls.get_config_dict(A			,   **A      )

								# get the qformer config dict if we are loading from InstructBlipConfig
								if config_dict.get('''model_type'''      ) == "instructblip":
													lowerCamelCase_					:      Optional[Any]     =		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(A			,   **A      )

class 	__lowercase				(  _lowercase    ):
			lowerCamelCase			:		Union[str, Any]	      =			"instructblip"
			lowerCamelCase			:		Tuple	      =			True

			def __init__(self			,   A=None			,   A=None			,   A=None			,   A=3_2			,   **A      ):
								super().__init__(**A      )

								if vision_config is None:
													lowerCamelCase_					:      int     =		{}
													logger.info('''vision_config is None. initializing the InstructBlipVisionConfig with default values.'''      )

								if qformer_config is None:
													lowerCamelCase_					:      int     =		{}
													logger.info('''qformer_config is None. Initializing the InstructBlipQFormerConfig with default values.'''      )

								if text_config is None:
													lowerCamelCase_					:      Union[str, Any]     =		{}
													logger.info('''text_config is None. Initializing the text config with default values (`OPTConfig`).'''      )

								lowerCamelCase_					:      Optional[Any]     =		InstructBlipVisionConfig(**A      )
								lowerCamelCase_					:      List[str]     =		InstructBlipQFormerConfig(**A      )
								lowerCamelCase_					:      Dict     =		text_config['''model_type'''] if '''model_type''' in text_config else '''opt'''
								lowerCamelCase_					:      Union[str, Any]     =		CONFIG_MAPPING[text_model_type](**A      )

								lowerCamelCase_					:      Union[str, Any]     =		self.text_config.tie_word_embeddings
								lowerCamelCase_					:      List[Any]     =		self.text_config.is_encoder_decoder

								lowerCamelCase_					:      int     =		num_query_tokens
								lowerCamelCase_					:      Union[str, Any]     =		self.vision_config.hidden_size
								lowerCamelCase_					:      Optional[Any]     =		self.text_config.model_type in MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
								lowerCamelCase_					:      str     =		1.0
								lowerCamelCase_					:      int     =		0.02

			@classmethod
			def        UpperCAmelCase__ (cls			,   A			,   A			,   A			,   **A			,   ):
								return cls(
								    vision_config=vision_config.to_dict()			,   qformer_config=qformer_config.to_dict()			,   text_config=text_config.to_dict()			,   **A			,   )






			def        UpperCAmelCase__ (self      ):
								lowerCamelCase_					:      Any     =		copy.deepcopy(self.__dict__      )
								lowerCamelCase_					:      Optional[int]     =		self.vision_config.to_dict()
								lowerCamelCase_					:      int     =		self.qformer_config.to_dict()
								lowerCamelCase_					:      Optional[int]     =		self.text_config.to_dict()
								lowerCamelCase_					:      str     =		self.__class__.model_type
								return output




'''simple docstring'''


def lowercase_	(   _lowercase = 1_000				)     ->							int:
					'''simple docstring'''

					lowerCamelCase_					:      Dict     =		2**power
					lowerCamelCase_					:      Union[str, Any]     =		str(_lowercase				)
					lowerCamelCase_					:      Union[str, Any]     =		list(_lowercase				)
					lowerCamelCase_					:      Dict     =		0

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

					return sum_of_num


if __name__ == "__main__":
					__lowercase							:   Optional[Any]					=     int(input('''Enter the power of 2: ''').strip())
					print('''2 ^ ''', power, ''' = ''', 2**power)
					__lowercase							:   Tuple					=     solution(power)
					print('''Sum of the digits is: ''', result)


