
import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig
from ..clip.configuration_clip import CLIPVisionConfig


SCREAMING_SNAKE_CASE__							=    logging.get_logger(__name__)
class      A__       (						lowerCAmelCase__    ):
							lowerCAmelCase__		:						int         =							"vision-text-dual-encoder"
							lowerCAmelCase__		:						str         =							True





							def __init__(			self  :       int					,			_UpperCAmelCase  :       int=5_12					,			_UpperCAmelCase  :       Tuple=2.6_592					,			**_UpperCAmelCase  :       Any    )						->		int:



											"""simple docstring"""


											super().__init__(**_UpperCAmelCase    )

											if "vision_config" not in kwargs:
															raise ValueError('`vision_config` can not be `None`.'    )

											if "text_config" not in kwargs:
															raise ValueError('`text_config` can not be `None`.'    )

											__lowercase								= kwargs.pop('vision_config'    )
											__lowercase								= kwargs.pop('text_config'    )

											__lowercase								= vision_config.pop('model_type'    )
											__lowercase								= text_config.pop('model_type'    )

											if vision_model_type == "clip":
															__lowercase								= AutoConfig.for_model(_UpperCAmelCase					,			**_UpperCAmelCase    ).vision_config
											elif vision_model_type == "clip_vision_model":
															__lowercase								= CLIPVisionConfig(**_UpperCAmelCase    )
											else:
															__lowercase								= AutoConfig.for_model(_UpperCAmelCase					,			**_UpperCAmelCase    )

											__lowercase								= AutoConfig.for_model(_UpperCAmelCase					,			**_UpperCAmelCase    )

											__lowercase								= projection_dim
											__lowercase								= logit_scale_init_value





							@classmethod
							def       a__			(			cls  :       Tuple					,			_UpperCAmelCase  :       PretrainedConfig					,			_UpperCAmelCase  :       PretrainedConfig					,			**_UpperCAmelCase  :       Optional[Any]    )						->		Tuple:



											"""simple docstring"""


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





							def       a__			(			self  :       int    )						->		str:



											"""simple docstring"""


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







from __future__ import annotations

from enum import Enum
class      A__       (						lowerCAmelCase__    ):
							lowerCAmelCase__		:						Dict         =							24
							lowerCAmelCase__		:						Dict         =							21
							lowerCAmelCase__		:						Union[str, Any]         =							18
							lowerCAmelCase__		:						Dict         =							15
							lowerCAmelCase__		:						Any         =							12
							lowerCAmelCase__		:						Union[str, Any]         =							9
							lowerCAmelCase__		:						Any         =							6
							lowerCAmelCase__		:						Optional[Any]         =							3
							lowerCAmelCase__		:						Union[str, Any]         =							2
							lowerCAmelCase__		:						List[Any]         =							1
							lowerCAmelCase__		:						Optional[Any]         =							-1
							lowerCAmelCase__		:						Tuple         =							-2
							lowerCAmelCase__		:						Dict         =							-3
							lowerCAmelCase__		:						Union[str, Any]         =							-6
							lowerCAmelCase__		:						Any         =							-9
							lowerCAmelCase__		:						Union[str, Any]         =							-12
							lowerCAmelCase__		:						str         =							-15
							lowerCAmelCase__		:						Optional[int]         =							-18
							lowerCAmelCase__		:						Any         =							-21
							lowerCAmelCase__		:						Any         =							-24






class      A__       (						lowerCAmelCase__    ):
							lowerCAmelCase__		:						Tuple         =							8
							lowerCAmelCase__		:						Union[str, Any]         =							7
							lowerCAmelCase__		:						Optional[Any]         =							6
							lowerCAmelCase__		:						Tuple         =							5
							lowerCAmelCase__		:						Optional[int]         =							4
							lowerCAmelCase__		:						Optional[int]         =							3
							lowerCAmelCase__		:						Optional[int]         =							2
							lowerCAmelCase__		:						Any         =							1






def 							__SCREAMING_SNAKE_CASE       (		SCREAMING_SNAKE_CASE	:				float   ,							SCREAMING_SNAKE_CASE	:				str | SIUnit   ,							SCREAMING_SNAKE_CASE	:				str | SIUnit   ,							)					->						float:
				if isinstance(SCREAMING_SNAKE_CASE   ,							SCREAMING_SNAKE_CASE      ):
								__lowercase								= SIUnit[known_prefix.lower()]
				if isinstance(SCREAMING_SNAKE_CASE   ,							SCREAMING_SNAKE_CASE      ):
								__lowercase								= SIUnit[unknown_prefix.lower()]
				__lowercase								= known_amount * (
				    10 ** (known_prefix.value - unknown_prefix.value)
				)
				return unknown_amount




def 							__SCREAMING_SNAKE_CASE       (		SCREAMING_SNAKE_CASE	:				float   ,							SCREAMING_SNAKE_CASE	:				str | BinaryUnit   ,							SCREAMING_SNAKE_CASE	:				str | BinaryUnit   ,							)					->						float:
				if isinstance(SCREAMING_SNAKE_CASE   ,							SCREAMING_SNAKE_CASE      ):
								__lowercase								= BinaryUnit[known_prefix.lower()]
				if isinstance(SCREAMING_SNAKE_CASE   ,							SCREAMING_SNAKE_CASE      ):
								__lowercase								= BinaryUnit[unknown_prefix.lower()]
				__lowercase								= known_amount * (
				    2 ** ((known_prefix.value - unknown_prefix.value) * 10)
				)
				return unknown_amount


if __name__ == "__main__":
							import doctest

							doctest.testmod()





