






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		:       Optional[Any]			     = logging.get_logger(__name__)

a		:       Tuple			     = {
    "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     a    ( lowercase__   ):



      """simple docstring"""


      a  : Dict							       =	'owlvit_text_model'
      def __init__(      self					:			List[str]		,      __lowercase					:			str=49408		,      __lowercase					:			Any=512		,      __lowercase					:			Dict=2048		,      __lowercase					:			Optional[Any]=12		,      __lowercase					:			Optional[Any]=8		,      __lowercase					:			List[Any]=16		,      __lowercase					:			Tuple="quick_gelu"		,      __lowercase					:			List[Any]=1e-5		,      __lowercase					:			Tuple=0.0		,      __lowercase					:			Union[str, Any]=0.02		,      __lowercase					:			Union[str, Any]=1.0		,      __lowercase					:			Union[str, Any]=0		,      __lowercase					:			List[str]=49406		,      __lowercase					:			Optional[int]=49407		,      **__lowercase					:			int		,      )							->      List[str]:
        super().__init__(pad_token_id=__a		,      bos_token_id=__a		,      eos_token_id=__a		,      **__a					)

        __UpperCAmelCase							:	Dict           =  vocab_size
        __UpperCAmelCase							:	Any           =  hidden_size
        __UpperCAmelCase							:	List[str]           =  intermediate_size
        __UpperCAmelCase							:	Optional[int]           =  num_hidden_layers
        __UpperCAmelCase							:	List[Any]           =  num_attention_heads
        __UpperCAmelCase							:	str           =  max_position_embeddings
        __UpperCAmelCase							:	Any           =  hidden_act
        __UpperCAmelCase							:	Optional[Any]           =  layer_norm_eps
        __UpperCAmelCase							:	Optional[int]           =  attention_dropout
        __UpperCAmelCase							:	Union[str, Any]           =  initializer_range
        __UpperCAmelCase							:	str           =  initializer_factor




      @classmethod
      def 	UpperCAmelCase      (      cls					:			List[Any]		,      __lowercase					:			int		,      **__lowercase					:			List[str]					)							->      "PretrainedConfig":
        cls._set_token_in_kwargs(__a					)

        __UpperCAmelCase      , __UpperCAmelCase							:	Optional[int]           =  cls.get_config_dict(__a		,      **__a					)

        # get the text config dict if we are loading from OwlViTConfig
        if config_dict.get("""model_type"""					) == "owlvit":
          __UpperCAmelCase							:	List[Any]           =  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(__a		,      **__a					)


class     a    ( lowercase__   ):



      """simple docstring"""


      a  : int							       =	'owlvit_vision_model'
      def __init__(      self					:			List[Any]		,      __lowercase					:			Tuple=768		,      __lowercase					:			Union[str, Any]=3072		,      __lowercase					:			Optional[Any]=12		,      __lowercase					:			Tuple=12		,      __lowercase					:			Optional[int]=3		,      __lowercase					:			Optional[Any]=768		,      __lowercase					:			int=32		,      __lowercase					:			Any="quick_gelu"		,      __lowercase					:			int=1e-5		,      __lowercase					:			Tuple=0.0		,      __lowercase					:			Union[str, Any]=0.02		,      __lowercase					:			Any=1.0		,      **__lowercase					:			Optional[Any]		,      )							->      Union[str, Any]:
        super().__init__(**__a					)

        __UpperCAmelCase							:	Optional[int]           =  hidden_size
        __UpperCAmelCase							:	Dict           =  intermediate_size
        __UpperCAmelCase							:	str           =  num_hidden_layers
        __UpperCAmelCase							:	List[Any]           =  num_attention_heads
        __UpperCAmelCase							:	Tuple           =  num_channels
        __UpperCAmelCase							:	Optional[int]           =  image_size
        __UpperCAmelCase							:	Dict           =  patch_size
        __UpperCAmelCase							:	List[str]           =  hidden_act
        __UpperCAmelCase							:	int           =  layer_norm_eps
        __UpperCAmelCase							:	int           =  attention_dropout
        __UpperCAmelCase							:	Dict           =  initializer_range
        __UpperCAmelCase							:	Tuple           =  initializer_factor




      @classmethod
      def 	UpperCAmelCase      (      cls					:			Union[str, Any]		,      __lowercase					:			Union[str, Any]		,      **__lowercase					:			int					)							->      "PretrainedConfig":
        cls._set_token_in_kwargs(__a					)

        __UpperCAmelCase      , __UpperCAmelCase							:	Union[str, Any]           =  cls.get_config_dict(__a		,      **__a					)

        # get the vision config dict if we are loading from OwlViTConfig
        if config_dict.get("""model_type"""					) == "owlvit":
          __UpperCAmelCase							:	Dict           =  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     a    ( lowercase__   ):



      """simple docstring"""


      a  : Optional[Any]							       =	'owlvit'
      a  : Optional[int]							       =	True
      def __init__(      self					:			str		,      __lowercase					:			str=None		,      __lowercase					:			Union[str, Any]=None		,      __lowercase					:			Tuple=512		,      __lowercase					:			Tuple=2.6_592		,      __lowercase					:			Any=True		,      **__lowercase					:			Dict		,      )							->      int:
        super().__init__(**__a					)

        if text_config is None:
          __UpperCAmelCase							:	Optional[Any]           =  {}
          logger.info("""text_config is None. Initializing the OwlViTTextConfig with default values."""					)

        if vision_config is None:
          __UpperCAmelCase							:	Optional[int]           =  {}
          logger.info("""vision_config is None. initializing the OwlViTVisionConfig with default values."""					)

        __UpperCAmelCase							:	Any           =  OwlViTTextConfig(**__a					)
        __UpperCAmelCase							:	List[str]           =  OwlViTVisionConfig(**__a					)

        __UpperCAmelCase							:	Any           =  projection_dim
        __UpperCAmelCase							:	int           =  logit_scale_init_value
        __UpperCAmelCase							:	Dict           =  return_dict
        __UpperCAmelCase							:	List[str]           =  1.0
      @classmethod
      def 	UpperCAmelCase      (      cls					:			Union[str, Any]		,      __lowercase					:			Optional[int]		,      **__lowercase					:			Tuple					)							->      "PretrainedConfig":
        cls._set_token_in_kwargs(__a					)

        __UpperCAmelCase      , __UpperCAmelCase							:	str           =  cls.get_config_dict(__a		,      **__a					)

        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					)
      @classmethod
      def 	UpperCAmelCase      (      cls					:			Dict		,      __lowercase					:			str		,      __lowercase					:			Tuple		,      **__lowercase					:			Optional[int]					)							->      Any:
        __UpperCAmelCase							:	Optional[int]           =  {}
        __UpperCAmelCase							:	int           =  text_config
        __UpperCAmelCase							:	Tuple           =  vision_config

        return cls.from_dict(__a		,      **__a					)




      def 	UpperCAmelCase      (      self					:			Any					)							->      Tuple:
        __UpperCAmelCase							:	Optional[Any]           =  copy.deepcopy(self.__dict__					)
        __UpperCAmelCase							:	str           =  self.text_config.to_dict()
        __UpperCAmelCase							:	Tuple           =  self.vision_config.to_dict()
        __UpperCAmelCase							:	Any           =  self.__class__.model_type
        return output


class     a    ( lowercase__   ):



      """simple docstring"""


      @property
      def 	UpperCAmelCase      (      self					:			List[Any]					)							->      Mapping[str, Mapping[int, str]]:
        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					:			Dict					)							->      Mapping[str, Mapping[int, str]]:
        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[Any]					)							->      float:
        return 1e-4
      def 	UpperCAmelCase      (      self					:			List[str]		,      __lowercase					:			Optional[int]		,      __lowercase					:			Any = -1		,      __lowercase					:			Tuple = -1		,      __lowercase					:			Optional[Any] = None		,      )							->      Mapping[str, Any]:
        __UpperCAmelCase							:	List[Any]           =  super().generate_dummy_inputs(
            processor.tokenizer		,      batch_size=__a		,      seq_length=__a		,      framework=__a					)
        __UpperCAmelCase							:	Optional[Any]           =  super().generate_dummy_inputs(
            processor.image_processor		,      batch_size=__a		,      framework=__a					)
        return {**text_input_dict, **image_input_dict}




      @property
      def 	UpperCAmelCase      (      self					:			str					)							->      int:
        return 14




"""simple docstring"""





from __future__ import annotations



def       lowerCamelCase__		(			__snake_case,     __snake_case	)							->		float:


					"""simple docstring"""





					_UpperCamelCase							 =  sorted(numsa + numsa	)
					_UpperCamelCase ,  _UpperCamelCase							 =  divmod(len(__snake_case	),     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														=		[float(x) for x in input("""Enter the elements of first array: """).split()]
				_a														=		[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)}""")






