




import copy

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


lowerCamelCase_  						=       logging.get_logger(__name__)
class 				__a (			__lowerCamelCase					):


     """simple docstring"""


     _A    :   List[str]     =  "vision-text-dual-encoder"
     _A    :   List[str]     =  True




     def __init__(     self      :			List[str]    ,_UpperCamelCase      :			int=5_1_2    ,_UpperCamelCase      :			List[str]=2.6592    ,**_UpperCamelCase      :			str						)		->       Optional[int]:


         '''simple docstring'''





         super().__init__(**_UpperCamelCase						)

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

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

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

         if vision_model_type == "clip":
             SCREAMING_SNAKE_CASE__       =AutoConfig.for_model(_UpperCamelCase    ,**_UpperCamelCase						).vision_config
         elif vision_model_type == "clip_vision_model":
             SCREAMING_SNAKE_CASE__       =CLIPVisionConfig(**_UpperCamelCase						)
         else:
             SCREAMING_SNAKE_CASE__       =AutoConfig.for_model(_UpperCamelCase    ,**_UpperCamelCase						)

         SCREAMING_SNAKE_CASE__       =AutoConfig.for_model(_UpperCamelCase    ,**_UpperCamelCase						)

         SCREAMING_SNAKE_CASE__       =projection_dim
         SCREAMING_SNAKE_CASE__       =logit_scale_init_value




     @classmethod
     def   __A    (     cls      :			Optional[int]    ,_UpperCamelCase      :			PretrainedConfig    ,_UpperCamelCase      :			PretrainedConfig    ,**_UpperCamelCase      :			str						)		->       List[str]:


         '''simple docstring'''





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




     def   __A    (     self      :			Optional[int]						)		->       Dict:


         '''simple docstring'''





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












from typing import TYPE_CHECKING

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


lowerCamelCase_  						=       {
    "configuration_marian": ["MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP", "MarianConfig", "MarianOnnxConfig"],
}

try:
    if not is_sentencepiece_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase_  						=       ["MarianTokenizer"]

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase_  						=       [
        "MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST",
        "MarianForCausalLM",
        "MarianModel",
        "MarianMTModel",
        "MarianPreTrainedModel",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase_  						=       ["TFMarianModel", "TFMarianMTModel", "TFMarianPreTrainedModel"]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase_  						=       ["FlaxMarianModel", "FlaxMarianMTModel", "FlaxMarianPreTrainedModel"]

if TYPE_CHECKING:
    from .configuration_marian import MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP, MarianConfig, MarianOnnxConfig

    try:
        if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_marian import MarianTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_marian import (
            MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST,
            MarianForCausalLM,
            MarianModel,
            MarianMTModel,
            MarianPreTrainedModel,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_marian import TFMarianModel, TFMarianMTModel, TFMarianPreTrainedModel

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_marian import FlaxMarianModel, FlaxMarianMTModel, FlaxMarianPreTrainedModel

else:
    import sys

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






