




import copy

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


__lowerCAmelCase		:    Dict	      =		logging.get_logger(__name__)




class    snake_case__							(_UpperCamelCase       ):
				"""simple docstring"""



				SCREAMING_SNAKE_CASE_	:							Dict										= """vision-text-dual-encoder"""
				SCREAMING_SNAKE_CASE_	:							Optional[int]										= True





				def __init__(				self    :					Dict ,				__lowerCamelCase    :					Union[str, Any]=5_12 ,				__lowerCamelCase    :					str=2.6_592 ,				**__lowerCamelCase    :					Union[str, Any]							) ->					List[str]:
							super().__init__(**__lowerCamelCase							)

							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`."							)

							a   =      kwargs.pop("vision_config"							)
							a   =      kwargs.pop("text_config"							)

							a   =      vision_config.pop("model_type"							)
							a   =      text_config.pop("model_type"							)

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

							a   =      AutoConfig.for_model(__lowerCamelCase ,				**__lowerCamelCase							)

							a   =      projection_dim
							a   =      logit_scale_init_value





				@classmethod
				def 							__UpperCAmelCase							(				cls    :					Optional[int] ,				__lowerCamelCase    :					PretrainedConfig ,				__lowerCamelCase    :					PretrainedConfig ,				**__lowerCamelCase    :					Optional[int]							) ->					Dict:
							return cls(vision_config=vision_config.to_dict() ,				text_config=text_config.to_dict() ,				**__lowerCamelCase							)





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












def       __magic_name__    (			A		: float       ):






			'''simple docstring'''







			return -num if num < 0 else num




def       __magic_name__    (			A		: list[int]       ):






			'''simple docstring'''







			if len(A       ) == 0:
						raise ValueError("abs_min() arg is an empty sequence"       )
			a   =      x[0]
			for i in x:
						if abs_val(A       ) < abs_val(A       ):
									a   =      i
			return j




def       __magic_name__    (			A		: list[int]       ):






			'''simple docstring'''







			if len(A       ) == 0:
						raise ValueError("abs_max() arg is an empty sequence"       )
			a   =      x[0]
			for i in x:
						if abs(A       ) > abs(A       ):
									a   =      i
			return j




def       __magic_name__    (			A		: list[int]       ):






			'''simple docstring'''







			if len(A       ) == 0:
						raise ValueError("abs_max_sort() arg is an empty sequence"       )
			return sorted(A,  key=A       )[-1]




def       __magic_name__    (			):






			'''simple docstring'''







			assert abs_val(0       ) == 0
			assert abs_val(34       ) == 34
			assert abs_val(-100000000000       ) == 100000000000

			a   =      [-3, -1, 2, -11]
			assert abs_max(A       ) == -11
			assert abs_max_sort(A       ) == -11
			assert abs_min(A       ) == -1


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		test_abs_val()
		print(abs_val(-34))  # --> 34






