




"""simple docstring"""

import copy

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


__A							=     logging.get_logger(__name__)
class      lowerCamelCase__      (					lowerCamelCase_     ):
			a__	: Union[str, Any]        =       """vision-text-dual-encoder"""
			a__	: Optional[Any]        =       True


			def __init__(       self			,	SCREAMING_SNAKE_CASE=512			,	SCREAMING_SNAKE_CASE=2.65_92			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					super().__init__(**SCREAMING_SNAKE_CASE							)

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

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

					snake_case						:  Any        =			vision_config.pop("model_type"							)
					snake_case						:  Optional[int]        =			text_config.pop("model_type"							)

					if vision_model_type == "clip":
							snake_case						:  Any        =			AutoConfig.for_model(SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							).vision_config
					elif vision_model_type == "clip_vision_model":
							snake_case						:  Dict        =			CLIPVisionConfig(**SCREAMING_SNAKE_CASE							)
					else:
							snake_case						:  int        =			AutoConfig.for_model(SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)

					snake_case						:  str        =			AutoConfig.for_model(SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)

					snake_case						:  List[str]        =			projection_dim
					snake_case						:  List[Any]        =			logit_scale_init_value


			@classmethod
			def 							lowerCamelCase_			(       cls			,	SCREAMING_SNAKE_CASE			,	SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







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



			def 							lowerCamelCase_			(       self							):



					"""simple docstring"""







					snake_case						:  List[Any]        =			copy.deepcopy(self.__dict__							)
					snake_case						:  Optional[Any]        =			self.vision_config.to_dict()
					snake_case						:  Optional[int]        =			self.text_config.to_dict()
					snake_case						:  Dict        =			self.__class__.model_type
					return output







"""simple docstring"""

from typing import TYPE_CHECKING

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


__A							=     {"configuration_gptj": ["GPTJ_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTJConfig", "GPTJOnnxConfig"]}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__A							=     [
							    "GPTJ_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "GPTJForCausalLM",
							    "GPTJForQuestionAnswering",
							    "GPTJForSequenceClassification",
							    "GPTJModel",
							    "GPTJPreTrainedModel",
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__A							=     [
							    "TFGPTJForCausalLM",
							    "TFGPTJForQuestionAnswering",
							    "TFGPTJForSequenceClassification",
							    "TFGPTJModel",
							    "TFGPTJPreTrainedModel",
							]

try:
							if not is_flax_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__A							=     [
							    "FlaxGPTJForCausalLM",
							    "FlaxGPTJModel",
							    "FlaxGPTJPreTrainedModel",
							]


if TYPE_CHECKING:
							from .configuration_gptj import GPTJ_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTJConfig, GPTJOnnxConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_gptj import (
														    GPTJ_PRETRAINED_MODEL_ARCHIVE_LIST,
														    GPTJForCausalLM,
														    GPTJForQuestionAnswering,
														    GPTJForSequenceClassification,
														    GPTJModel,
														    GPTJPreTrainedModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_gptj import (
														    TFGPTJForCausalLM,
														    TFGPTJForQuestionAnswering,
														    TFGPTJForSequenceClassification,
														    TFGPTJModel,
														    TFGPTJPreTrainedModel,
														)

							try:
														if not is_flax_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flax_gptj import FlaxGPTJForCausalLM, FlaxGPTJModel, FlaxGPTJPreTrainedModel

else:
							import sys

							__A							=     _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

