



"""simple docstring"""






import copy

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


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

class 			__SCREAMING_SNAKE_CASE      ( lowerCAmelCase_  ):


					'''simple docstring'''





					_a       =				'hybrid-clip'
					_a       =				True



					def __init__(			self				:    Union[str, Any],    lowerCamelCase				:    Dict=512,    **lowerCamelCase				:    Union[str, Any]	)->   Optional[int]:
								super().__init__(**lowerCamelCase	)

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

								lowerCamelCase__						:						str						      =kwargs.pop('''text_config'''	)
								lowerCamelCase__						:						int						      =kwargs.pop('''vision_config'''	)

								lowerCamelCase__						:						Tuple						      =text_config.pop('''model_type'''	)
								lowerCamelCase__						:						Any						      =vision_config.pop('''model_type'''	)

								from transformers import AutoConfig

								lowerCamelCase__						:						int						      =AutoConfig.for_model(lowerCamelCase,    **lowerCamelCase	)

								if vision_model_type == "clip":
											lowerCamelCase__						:						Optional[int]						      =AutoConfig.for_model(lowerCamelCase,    **lowerCamelCase	).vision_config
								elif vision_model_type == "clip_vision_model":
											from transformers import CLIPVisionConfig

											lowerCamelCase__						:						Optional[int]						      =CLIPVisionConfig(**lowerCamelCase	)
								else:
											lowerCamelCase__						:						List[str]						      =AutoConfig.for_model(lowerCamelCase,    **lowerCamelCase	)

								lowerCamelCase__						:						List[str]						      =projection_dim
								lowerCamelCase__						:						Dict						      =1.0



					@classmethod
					def 						snake_case			(			cls				:    Optional[Any],    lowerCamelCase				:    PretrainedConfig,    lowerCamelCase				:    PretrainedConfig,    **lowerCamelCase				:    Optional[int]	)->   int:
								return cls(text_config=text_config.to_dict(),    vision_config=vision_config.to_dict(),    **lowerCamelCase	)




					def 						snake_case			(			self				:    Dict	)->   Union[str, Any]:
								lowerCamelCase__						:						Dict						      =copy.deepcopy(self.__dict__	)
								lowerCamelCase__						:						List[str]						      =self.text_config.to_dict()
								lowerCamelCase__						:						List[str]						      =self.vision_config.to_dict()
								lowerCamelCase__						:						str						      =self.__class__.model_type
								return output









"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_lowercase					:					str 		=		{
    "configuration_openai": ["OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "OpenAIGPTConfig"],
    "tokenization_openai": ["OpenAIGPTTokenizer"],
}

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase					:					List[Any] 		=		["OpenAIGPTTokenizerFast"]

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase					:					Union[str, Any] 		=		[
		    "OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST",
		    "OpenAIGPTDoubleHeadsModel",
		    "OpenAIGPTForSequenceClassification",
		    "OpenAIGPTLMHeadModel",
		    "OpenAIGPTModel",
		    "OpenAIGPTPreTrainedModel",
		    "load_tf_weights_in_openai_gpt",
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_lowercase					:					Optional[Any] 		=		[
		    "TF_OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST",
		    "TFOpenAIGPTDoubleHeadsModel",
		    "TFOpenAIGPTForSequenceClassification",
		    "TFOpenAIGPTLMHeadModel",
		    "TFOpenAIGPTMainLayer",
		    "TFOpenAIGPTModel",
		    "TFOpenAIGPTPreTrainedModel",
		]


if TYPE_CHECKING:
		from .configuration_openai import OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP, OpenAIGPTConfig
		from .tokenization_openai import OpenAIGPTTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_openai_fast import OpenAIGPTTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_openai import (
				    OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    OpenAIGPTDoubleHeadsModel,
				    OpenAIGPTForSequenceClassification,
				    OpenAIGPTLMHeadModel,
				    OpenAIGPTModel,
				    OpenAIGPTPreTrainedModel,
				    load_tf_weights_in_openai_gpt,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_openai import (
				    TF_OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFOpenAIGPTDoubleHeadsModel,
				    TFOpenAIGPTForSequenceClassification,
				    TFOpenAIGPTLMHeadModel,
				    TFOpenAIGPTMainLayer,
				    TFOpenAIGPTModel,
				    TFOpenAIGPTPreTrainedModel,
				)

else:
		import sys

		_lowercase					:					Dict 		=		_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




