



import copy

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


A_		:  str										=  logging.get_logger(__name__)



class 		_lowercase		(							UpperCAmelCase__						):
   _UpperCAmelCase  						=      '''vision-text-dual-encoder'''
   _UpperCAmelCase  						=      True

   def __init__(   self      :							Dict				, __lowerCAmelCase      :							Any=512				, __lowerCAmelCase      :							Any=2.6_5_9_2				, **__lowerCAmelCase      :							str				)							->					Optional[int]:


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

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

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

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

    a							=		AutoConfig.for_model(__lowerCAmelCase				, **__lowerCAmelCase				)

    a							=		projection_dim
    a							=		logit_scale_init_value

   @classmethod
   def 		A				(   cls      :							str				, __lowerCAmelCase      :							PretrainedConfig				, __lowerCAmelCase      :							PretrainedConfig				, **__lowerCAmelCase      :							Optional[Any]				)							->					Union[str, Any]:


    """simple docstring"""






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




   def 		A				(   self      :							str				)							->					int:


    """simple docstring"""






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



"""simple docstring"""






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,
)


__UpperCAmelCase 					=    {
    'configuration_marian': ['MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MarianConfig', 'MarianOnnxConfig'],
}

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

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

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

try:
				if not is_flax_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__UpperCAmelCase 					=    ['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

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






