'''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


_lowerCamelCase :				str														= logging.get_logger(__name__)




class    lowerCamelCase__  (   __snake_case     ):
   __UpperCAmelCase           =						"""vision-text-dual-encoder"""
   __UpperCAmelCase           =						True



   def __init__(    self					,      lowerCAmelCase__=512					,      lowerCAmelCase__=2.6592					,      **lowerCAmelCase__     )				->     str:
        """simple docstring"""





        super().__init__(**lowerCAmelCase__     )

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

        _UpperCamelCase  :Optional[int]       =kwargs.pop("""vision_config"""     )
        _UpperCamelCase  :List[Any]       =kwargs.pop("""text_config"""     )

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

        if vision_model_type == "clip":
             _UpperCamelCase  :str       =AutoConfig.for_model(lowerCAmelCase__					,      **lowerCAmelCase__     ).vision_config
        elif vision_model_type == "clip_vision_model":
             _UpperCamelCase  :Union[str, Any]       =CLIPVisionConfig(**lowerCAmelCase__     )
        else:
             _UpperCamelCase  :List[str]       =AutoConfig.for_model(lowerCAmelCase__					,      **lowerCAmelCase__     )

        _UpperCamelCase  :int       =AutoConfig.for_model(lowerCAmelCase__					,      **lowerCAmelCase__     )

        _UpperCamelCase  :Any       =projection_dim
        _UpperCamelCase  :Tuple       =logit_scale_init_value



   @classmethod
   def  _UpperCamelCase		(    cls					,      lowerCAmelCase__					,      lowerCAmelCase__					,      **lowerCAmelCase__     )				->     List[Any]:
        """simple docstring"""





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




   def  _UpperCamelCase		(    self     )				->     Optional[int]:
        """simple docstring"""





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





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCamelCase__						=		{
    'configuration_prophetnet': ['PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ProphetNetConfig'],
    'tokenization_prophetnet': ['ProphetNetTokenizer'],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase__						=		[
							    'PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'ProphetNetDecoder',
							    'ProphetNetEncoder',
							    'ProphetNetForCausalLM',
							    'ProphetNetForConditionalGeneration',
							    'ProphetNetModel',
							    'ProphetNetPreTrainedModel',
							]


if TYPE_CHECKING:
							from .configuration_prophetnet import PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, ProphetNetConfig
							from .tokenization_prophetnet import ProphetNetTokenizer

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_prophetnet import (
														    PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
														    ProphetNetDecoder,
														    ProphetNetEncoder,
														    ProphetNetForCausalLM,
														    ProphetNetForConditionalGeneration,
														    ProphetNetModel,
														    ProphetNetPreTrainedModel,
														)

else:
							import sys

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