





import copy

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


UpperCamelCase__ :			Optional[int]       	=			logging.get_logger(__name__)







class 	_UpperCamelCase	(							A_	):







					'''simple docstring'''

					lowerCamelCase  :  List[Any]           =							'hybrid-clip'
					lowerCamelCase  :  Any           =							True





					def __init__(    self     :	List[Any]			,       __lowercase     :	Optional[Any]=5_12			,       **__lowercase     :	int		):






						'''simple docstring'''







						super().__init__(**__lowercase		)

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

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

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

						from transformers import AutoConfig

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

						if vision_model_type == "clip":
							UpperCAmelCase_		    =  AutoConfig.for_model(__lowercase			,       **__lowercase		).vision_config
						elif vision_model_type == "clip_vision_model":
							from transformers import CLIPVisionConfig

							UpperCAmelCase_		    =  CLIPVisionConfig(**__lowercase		)
						else:
							UpperCAmelCase_		    =  AutoConfig.for_model(__lowercase			,       **__lowercase		)

						UpperCAmelCase_		    =  projection_dim
						UpperCAmelCase_		    =  1.0





					@classmethod
					def 							SCREAMING_SNAKE_CASE				(    cls     :	List[str]			,       __lowercase     :	PretrainedConfig			,       __lowercase     :	PretrainedConfig			,       **__lowercase     :	int		):






						'''simple docstring'''







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





					def 							SCREAMING_SNAKE_CASE				(    self     :	List[str]		):






						'''simple docstring'''







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









from typing import TYPE_CHECKING

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


UpperCamelCase__ :			Any       	=			{
    """configuration_splinter""": ["""SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SplinterConfig"""],
    """tokenization_splinter""": ["""SplinterTokenizer"""],
}

try:
				if not is_tokenizers_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCamelCase__ :			Any       	=			["""SplinterTokenizerFast"""]

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCamelCase__ :			Union[str, Any]       	=			[
				    """SPLINTER_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """SplinterForQuestionAnswering""",
				    """SplinterForPreTraining""",
				    """SplinterLayer""",
				    """SplinterModel""",
				    """SplinterPreTrainedModel""",
				]


if TYPE_CHECKING:
				from .configuration_splinter import SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP, SplinterConfig
				from .tokenization_splinter import SplinterTokenizer

				try:
								if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_splinter_fast import SplinterTokenizerFast

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_splinter import (
								    SPLINTER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    SplinterForPreTraining,
								    SplinterForQuestionAnswering,
								    SplinterLayer,
								    SplinterModel,
								    SplinterPreTrainedModel,
								)


else:
				import sys

				UpperCamelCase__ :			List[str]       	=			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


