





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


A__:    Any  	=	logging.get_logger(__name__)

A__:    Any  	=	{
    '''salesforce/blip2-opt-2.7b''': '''https://huggingface.co/salesforce/blip2-opt-2.7b/resolve/main/config.json''',
}




class        _a    (    UpperCamelCase__):

      """simple docstring"""


      UpperCamelCase__  		=       """blip_2_vision_model"""






      def __init__(		self:			Tuple	,    __lowerCamelCase:			List[Any]=1408	,    __lowerCamelCase:			Optional[Any]=6144	,    __lowerCamelCase:			List[Any]=39	,    __lowerCamelCase:			Dict=16	,    __lowerCamelCase:			Optional[int]=224	,    __lowerCamelCase:			int=14	,    __lowerCamelCase:			str="gelu"	,    __lowerCamelCase:			Any=0.00_001	,    __lowerCamelCase:			int=0.0	,    __lowerCamelCase:			Dict=1e-10	,    __lowerCamelCase:			Any=True	,    **__lowerCamelCase:			Dict	,    ):
          '''simple docstring'''


          super().__init__(**__lowerCamelCase					)

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






      @classmethod
      def 			UpperCAmelCase_       (		cls:			Tuple	,    __lowerCamelCase:			Union[str, os.PathLike]	,    **__lowerCamelCase:			Optional[int]					):
          '''simple docstring'''


          cls._set_token_in_kwargs(__lowerCamelCase					)

          UpperCamelCase__				, UpperCamelCase__:	Optional[Any]					=     cls.get_config_dict(__lowerCamelCase	,    **__lowerCamelCase					)

          # get the vision config dict if we are loading from Blip2Config
          if config_dict.get("model_type"					) == "blip-2":
              UpperCamelCase__:	Union[str, Any]					=     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(__lowerCamelCase	,    **__lowerCamelCase					)




class        _a    (    UpperCamelCase__):

      """simple docstring"""


      UpperCamelCase__  		=       """blip_2_qformer"""






      def __init__(		self:			List[Any]	,    __lowerCamelCase:			str=3_0522	,    __lowerCamelCase:			List[str]=768	,    __lowerCamelCase:			Any=12	,    __lowerCamelCase:			Optional[Any]=12	,    __lowerCamelCase:			List[Any]=3072	,    __lowerCamelCase:			Union[str, Any]="gelu"	,    __lowerCamelCase:			Tuple=0.1	,    __lowerCamelCase:			Union[str, Any]=0.1	,    __lowerCamelCase:			int=512	,    __lowerCamelCase:			int=0.02	,    __lowerCamelCase:			Optional[int]=1e-12	,    __lowerCamelCase:			Tuple=0	,    __lowerCamelCase:			List[Any]="absolute"	,    __lowerCamelCase:			str=2	,    __lowerCamelCase:			Optional[Any]=1408	,    **__lowerCamelCase:			Optional[int]	,    ):
          '''simple docstring'''


          super().__init__(pad_token_id=__lowerCamelCase	,    **__lowerCamelCase					)

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






      @classmethod
      def 			UpperCAmelCase_       (		cls:			int	,    __lowerCamelCase:			Union[str, os.PathLike]	,    **__lowerCamelCase:			Optional[int]					):
          '''simple docstring'''


          cls._set_token_in_kwargs(__lowerCamelCase					)

          UpperCamelCase__				, UpperCamelCase__:	Tuple					=     cls.get_config_dict(__lowerCamelCase	,    **__lowerCamelCase					)

          # get the qformer config dict if we are loading from Blip2Config
          if config_dict.get("model_type"					) == "blip-2":
              UpperCamelCase__:	str					=     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(__lowerCamelCase	,    **__lowerCamelCase					)




class        _a    (    UpperCamelCase__):

      """simple docstring"""


      UpperCamelCase__  		=       """blip-2"""
      UpperCamelCase__  		=       True






      def __init__(		self:			Union[str, Any]	,    __lowerCamelCase:			Optional[Any]=None	,    __lowerCamelCase:			Optional[Any]=None	,    __lowerCamelCase:			Any=None	,    __lowerCamelCase:			int=32	,    **__lowerCamelCase:			str					):
          '''simple docstring'''


          super().__init__(**__lowerCamelCase					)

          if vision_config is None:
              UpperCamelCase__:	Dict					=     {}
              logger.info("vision_config is None. initializing the Blip2VisionConfig with default values."					)

          if qformer_config is None:
              UpperCamelCase__:	int					=     {}
              logger.info("qformer_config is None. Initializing the Blip2QFormerConfig with default values."					)

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

          UpperCamelCase__:	Tuple					=     BlipaVisionConfig(**__lowerCamelCase					)
          UpperCamelCase__:	int					=     BlipaQFormerConfig(**__lowerCamelCase					)
          UpperCamelCase__:	List[Any]					=     text_config["model_type"] if "model_type" in text_config else "opt"
          UpperCamelCase__:	Optional[Any]					=     CONFIG_MAPPING[text_model_type](**__lowerCamelCase					)

          UpperCamelCase__:	List[Any]					=     self.text_config.tie_word_embeddings
          UpperCamelCase__:	Any					=     self.text_config.is_encoder_decoder

          UpperCamelCase__:	List[Any]					=     num_query_tokens
          UpperCamelCase__:	Any					=     self.vision_config.hidden_size
          UpperCamelCase__:	Any					=     self.text_config.model_type in MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
          UpperCamelCase__:	Optional[int]					=     1.0
          UpperCamelCase__:	Tuple					=     0.02






      @classmethod
      def 			UpperCAmelCase_       (		cls:			int	,    __lowerCamelCase:			BlipaVisionConfig	,    __lowerCamelCase:			BlipaQFormerConfig	,    __lowerCamelCase:			PretrainedConfig	,    **__lowerCamelCase:			str	,    ):
          '''simple docstring'''


          return cls(
              vision_config=vision_config.to_dict()	,    qformer_config=qformer_config.to_dict()	,    text_config=text_config.to_dict()	,    **__lowerCamelCase	,    )






      def 			UpperCAmelCase_       (		self:			Dict					):
          '''simple docstring'''


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








def 				lowerCAmelCase_ (							A_):
    UpperCamelCase__:	Optional[int]					=     len(A_)
    for i in range(1    ,A_):
        UpperCamelCase__:	List[Any]					=     collection[i]
        UpperCamelCase__:	Tuple					=     0
        UpperCamelCase__:	Union[str, Any]					=     i - 1

        while low <= high:
            UpperCamelCase__:	Any					=     (low + high) // 2
            if val < collection[mid]:
                UpperCamelCase__:	str					=     mid - 1
            else:
                UpperCamelCase__:	str					=     mid + 1
        for j in range(A_    ,A_    ,-1):
            UpperCamelCase__:	Optional[int]					=     collection[j - 1]
        UpperCamelCase__:	Optional[Any]					=     val
    return collection


if __name__ == "__main__":
   A__:    Dict  	=	input('''Enter numbers separated by a comma:\n''').strip()
   A__:    Optional[int]  	=	[int(item) for item in user_input.split(''',''')]
   print(binary_insertion_sort(unsorted))

