





import copy

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


UpperCAmelCase__  :	Union[str, Any]     =logging.get_logger(__name__)

class 					__A   (  a			):
				__A            = """vision-text-dual-encoder"""
				__A            = True


				def __init__(						self      ,       UpperCAmelCase_=512      ,       UpperCAmelCase_=2.6_5_9_2      ,       **UpperCAmelCase_							):
								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`."""							)

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

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

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

								lowerCamelCase		       =AutoConfig.for_model(UpperCAmelCase_      ,       **UpperCAmelCase_							)

								lowerCamelCase		       =projection_dim
								lowerCamelCase		       =logit_scale_init_value


				@classmethod
				def _snake_case				(						cls      ,       UpperCAmelCase_      ,       UpperCAmelCase_      ,       **UpperCAmelCase_							):
								return cls(vision_config=vision_config.to_dict()      ,       text_config=text_config.to_dict()      ,       **UpperCAmelCase_							)


				def _snake_case				(						self							):
								lowerCamelCase		       =copy.deepcopy(self.__dict__							)
								lowerCamelCase		       =self.vision_config.to_dict()
								lowerCamelCase		       =self.text_config.to_dict()
								lowerCamelCase		       =self.__class__.model_type
								return output







"""simple docstring"""


import enum
import inspect
import warnings
from functools import wraps
from typing import Callable, Optional

from .logging import get_logger


__A       						=       set()
__A       						=       get_logger(__name__)



def     _lowerCamelCase(__UpperCamelCase = None       )				-> Optional[Any]:

	def decorator(__UpperCamelCase       ):
		global _emitted_deprecation_warnings

		if inspect.isclass(__UpperCamelCase       ):
			_lowerCAmelCase								=deprecated_class_or_function.__init__
			_lowerCAmelCase								=deprecated_class_or_function.__name__
		else:
			_lowerCAmelCase								=deprecated_class_or_function
			_lowerCAmelCase								=deprecated_function.__name__
			# Support deprecating __init__ class method: class name instead
			_lowerCAmelCase								=name if name != """__init__""" else deprecated_function.__qualname__.split("""."""       )[-2]

		_lowerCAmelCase								=(
		    F'''{name} is deprecated and will be removed in the next major version of datasets.''' + F''' {help_message}'''
		    if help_message
		    else """"""
		)

		@wraps(__UpperCamelCase       )
		def wrapper(*__UpperCamelCase    , **__UpperCamelCase       ):
			_lowerCAmelCase								=hash(__UpperCamelCase       )
			if func_hash not in _emitted_deprecation_warnings:
				warnings.warn(__UpperCamelCase    , category=__UpperCamelCase    , stacklevel=2       )
				_emitted_deprecation_warnings.add(__UpperCamelCase       )
			return deprecated_function(*__UpperCamelCase    , **__UpperCamelCase       )

		_lowerCAmelCase								="""deprecated"""

		if inspect.isclass(__UpperCamelCase       ):
			_lowerCAmelCase								=wrapper
			return deprecated_class_or_function
		else:
			return wrapper

	return decorator







class 		lowerCamelCase__					(					enum.EnumMeta				):





			'''simple docstring'''



			def __getattribute__(							cls     ,     __UpperCAmelCase  ) ->     Optional[int]:
				_lowerCAmelCase								=super().__getattribute__(__UpperCAmelCase  )
				if isinstance(__UpperCAmelCase     ,     enum.Enum  ) and obj._on_access:
					obj._on_access()
				return obj



			def __getitem__(							cls     ,     __UpperCAmelCase  ) ->     List[str]:
				_lowerCAmelCase								=super().__getitem__(__UpperCAmelCase  )
				if member._on_access:
					member._on_access()
				return member



			def __call__(							cls     ,     __UpperCAmelCase     ,     __UpperCAmelCase=None     ,     *, __UpperCAmelCase=None     ,     __UpperCAmelCase=None     ,     __UpperCAmelCase=None     ,     __UpperCAmelCase=1  ) ->     Optional[Any]:
				_lowerCAmelCase								=super().__call__(__UpperCAmelCase     ,     __UpperCAmelCase     ,     module=__UpperCAmelCase     ,     qualname=__UpperCAmelCase     ,     type=__UpperCAmelCase     ,     start=__UpperCAmelCase  )
				if isinstance(__UpperCAmelCase     ,     enum.Enum  ) and obj._on_access:
					obj._on_access()
				return obj







class 		lowerCamelCase__					(					enum.Enum ,	metaclass=__magic_name__				):





			'''simple docstring'''



			def __new__(							cls     ,     __UpperCAmelCase  ) ->     Optional[int]:
				_lowerCAmelCase								=object.__new__(cls  )
				_lowerCAmelCase								=value
				_lowerCAmelCase								=member.deprecate
				return member



			@property
			def 					_lowerCAmelCase		(							self  ) ->     List[Any]:
				return ""



			def 					_lowerCAmelCase		(							self  ) ->     Tuple:
				_lowerCAmelCase								=f''' {self.help_message}''' if self.help_message else """"""
				warnings.warn(
				    f'''\'{self.__objclass__.__name__}\' is deprecated and will be removed in the next major version of datasets.'''
				    + help_message     ,     __UpperCAmelCase     ,     stacklevel=3     ,     )



