






"""simple docstring"""



import copy

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


A_     =				logging.get_logger(__name__)






class 				__SCREAMING_SNAKE_CASE    (					UpperCamelCase		):
							snake_case_  =				'hybrid-clip'
							snake_case_  =				True


							def __init__(      self   :    List[Any]      ,     snake_case   :    Optional[Any]=512      ,     **snake_case   :    str				):
													'''simple docstring'''





													super().__init__(**snake_case				)

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

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

													A__    :	Tuple			=	kwargs.pop("""text_config"""				)
													A__    :	List[str]			=	kwargs.pop("""vision_config"""				)

													A__    :	Optional[Any]			=	text_config.pop("""model_type"""				)
													A__    :	Union[str, Any]			=	vision_config.pop("""model_type"""				)

													from transformers import AutoConfig

													A__    :	Any			=	AutoConfig.for_model(snake_case      ,     **snake_case				)

													if vision_model_type == "clip":
																			A__    :	Optional[Any]			=	AutoConfig.for_model(snake_case      ,     **snake_case				).vision_config
													elif vision_model_type == "clip_vision_model":
																			from transformers import CLIPVisionConfig

																			A__    :	int			=	CLIPVisionConfig(**snake_case				)
													else:
																			A__    :	int			=	AutoConfig.for_model(snake_case      ,     **snake_case				)

													A__    :	Optional[int]			=	projection_dim
													A__    :	Optional[Any]			=	1.0


							@classmethod
							def     _UpperCamelCase							(      cls   :    Union[str, Any]      ,     snake_case   :    PretrainedConfig      ,     snake_case   :    PretrainedConfig      ,     **snake_case   :    Optional[Any]				):
													'''simple docstring'''





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


							def     _UpperCamelCase							(      self   :    List[str]				):
													'''simple docstring'''





													A__    :	str			=	copy.deepcopy(self.__dict__				)
													A__    :	int			=	self.text_config.to_dict()
													A__    :	List[Any]			=	self.vision_config.to_dict()
													A__    :	Tuple			=	self.__class__.model_type
													return output














"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


A_     =				{
    '''configuration_deformable_detr''': ['''DEFORMABLE_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DeformableDetrConfig'''],
}

try:
						if not is_vision_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A_     =				['''DeformableDetrFeatureExtractor''']
						A_     =				['''DeformableDetrImageProcessor''']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A_     =				[
						    '''DEFORMABLE_DETR_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''DeformableDetrForObjectDetection''',
						    '''DeformableDetrModel''',
						    '''DeformableDetrPreTrainedModel''',
						]


if TYPE_CHECKING:
						from .configuration_deformable_detr import DEFORMABLE_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP, DeformableDetrConfig

						try:
												if not is_vision_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_deformable_detr import DeformableDetrFeatureExtractor
												from .image_processing_deformable_detr import DeformableDetrImageProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_deformable_detr import (
												    DEFORMABLE_DETR_PRETRAINED_MODEL_ARCHIVE_LIST,
												    DeformableDetrForObjectDetection,
												    DeformableDetrModel,
												    DeformableDetrPreTrainedModel,
												)

else:
						import sys

						A_     =				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






