





import copy
import os
from typing import Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


a__      :     List[Any]         =		logging.get_logger(__name__)

a__      :     Tuple         =		{
    'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/config.json',
    'Salesforce/blip-vqa-capfit-large': (
        'https://huggingface.co/Salesforce/blip-vqa-base-capfit/resolve/main/config.json'
    ),
    'Salesforce/blip-image-captioning-base': (
        'https://huggingface.co/Salesforce/blip-image-captioning-base/resolve/main/config.json'
    ),
    'Salesforce/blip-image-captioning-large': (
        'https://huggingface.co/Salesforce/blip-image-captioning-large/resolve/main/config.json'
    ),
    'Salesforce/blip-itm-base-coco': 'https://huggingface.co/Salesforce/blip-itm-base-coco/resolve/main/config.json',
    'Salesforce/blip-itm-large-coco': 'https://huggingface.co/Salesforce/blip-itm-large-coco/resolve/main/config.json',
    'Salesforce/blip-itm-base-flikr': 'https://huggingface.co/Salesforce/blip-itm-base-flikr/resolve/main/config.json',
    'Salesforce/blip-itm-large-flikr': (
        'https://huggingface.co/Salesforce/blip-itm-large-flikr/resolve/main/config.json'
    ),
}





class UpperCAmelCase_				( _SCREAMING_SNAKE_CASE ):
  __lowerCAmelCase   :						List[Any]							=   """blip_text_model"""


  def __init__(							self ,__snake_case=3_0_5_2_4 ,__snake_case=7_6_8 ,__snake_case=7_6_8 ,__snake_case=3_0_7_2 ,__snake_case=7_6_8 ,__snake_case=1_2 ,__snake_case=8 ,__snake_case=5_1_2 ,__snake_case="gelu" ,__snake_case=1E-12 ,__snake_case=0.0 ,__snake_case=0.0 ,__snake_case=0.02 ,__snake_case=3_0_5_2_2 ,__snake_case=2 ,__snake_case=0 ,__snake_case=1_0_2 ,__snake_case=True ,__snake_case=True ,**__snake_case ,):



       """simple docstring"""





       super().__init__(
           pad_token_id=__snake_case ,bos_token_id=__snake_case ,eos_token_id=__snake_case ,sep_token_id=__snake_case ,**__snake_case ,)

       A_          =       vocab_size
       A_          =       hidden_size
       A_          =       encoder_hidden_size
       A_          =       intermediate_size
       A_          =       projection_dim
       A_          =       hidden_dropout_prob
       A_          =       num_hidden_layers
       A_          =       num_attention_heads
       A_          =       max_position_embeddings
       A_          =       layer_norm_eps
       A_          =       hidden_act
       A_          =       initializer_range
       A_          =       attention_probs_dropout_prob
       A_          =       is_decoder
       A_          =       use_cache




  @classmethod
  def 						__UpperCAmelCase     (							cls ,__snake_case ,**__snake_case ):



       """simple docstring"""





       cls._set_token_in_kwargs(__snake_case )

       A_   ,    A_          =       cls.get_config_dict(__snake_case ,**__snake_case )

       # get the text config dict if we are loading from BlipConfig
       if config_dict.get('''model_type''' ) == "blip":
            A_          =       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 ):
  __lowerCAmelCase   :						Optional[Any]							=   """blip_vision_model"""


  def __init__(							self ,__snake_case=7_6_8 ,__snake_case=3_0_7_2 ,__snake_case=5_1_2 ,__snake_case=1_2 ,__snake_case=1_2 ,__snake_case=3_8_4 ,__snake_case=1_6 ,__snake_case="gelu" ,__snake_case=1E-5 ,__snake_case=0.0 ,__snake_case=1E-10 ,**__snake_case ,):



       """simple docstring"""





       super().__init__(**__snake_case )

       A_          =       hidden_size
       A_          =       intermediate_size
       A_          =       projection_dim
       A_          =       num_hidden_layers
       A_          =       num_attention_heads
       A_          =       patch_size
       A_          =       image_size
       A_          =       initializer_range
       A_          =       attention_dropout
       A_          =       layer_norm_eps
       A_          =       hidden_act




  @classmethod
  def 						__UpperCAmelCase     (							cls ,__snake_case ,**__snake_case ):



       """simple docstring"""





       cls._set_token_in_kwargs(__snake_case )

       A_   ,    A_          =       cls.get_config_dict(__snake_case ,**__snake_case )

       # get the vision config dict if we are loading from BlipConfig
       if config_dict.get('''model_type''' ) == "blip":
            A_          =       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 ):
  __lowerCAmelCase   :						Optional[int]							=   """blip"""
  __lowerCAmelCase   :						Any							=   True


  def __init__(							self ,__snake_case=None ,__snake_case=None ,__snake_case=5_1_2 ,__snake_case=2.6592 ,__snake_case=2_5_6 ,**__snake_case ,):



       """simple docstring"""





       super().__init__(**__snake_case )

       if text_config is None:
            A_          =       {}
            logger.info('''`text_config` is `None`. Initializing the `BlipTextConfig` with default values.''' )

       if vision_config is None:
            A_          =       {}
            logger.info('''`vision_config` is `None`. Initializing the `BlipVisionConfig` with default values.''' )

       A_          =       BlipTextConfig(**__snake_case )
       A_          =       BlipVisionConfig(**__snake_case )

       A_          =       self.vision_config.hidden_size

       A_          =       projection_dim
       A_          =       logit_scale_init_value
       A_          =       1.0
       A_          =       0.02
       A_          =       image_text_hidden_size


  @classmethod
  def 						__UpperCAmelCase     (							cls ,__snake_case ,__snake_case ,**__snake_case ):



       """simple docstring"""





       return cls(text_config=text_config.to_dict() ,vision_config=vision_config.to_dict() ,**__snake_case )




  def 						__UpperCAmelCase     (							self ):



       """simple docstring"""





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










from __future__ import annotations

def      UpperCAmelCase_    (    _UpperCAmelCase							:list[float]  ,						_UpperCAmelCase							:list[float]				)	->				float:
     '''simple docstring'''


     A_          =       sorted(numsa + numsa				)
     A_   ,    A_          =       divmod(len(_UpperCAmelCase				)  ,						2				)
     if mod == 1:
          return all_numbers[div]
     else:
          return (all_numbers[div] + all_numbers[div - 1]) / 2


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      a__      :     Optional[Any]         =		[float(x) for x in input('Enter the elements of first array: ').split()]
      a__      :     int         =		[float(x) for x in input('Enter the elements of second array: ').split()]
      print(f'''The median of two arrays is: {median_of_two_arrays(array_a, array_a)}''')



