



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


lowercase__  :	List[Any]            =      logging.get_logger(__name__)

class    lowerCamelCase_				(						lowerCAmelCase_	):






   '''simple docstring'''

   A			:  int					=						"vision-text-dual-encoder"
   A			:  Tuple					=						True


   def __init__(	self  ,    __UpperCamelCase=5_12  ,    __UpperCamelCase=2.6_592  ,    **__UpperCamelCase			):
       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`."			)

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

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

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

       UpperCamelCase__	     =      AutoConfig.for_model(__UpperCamelCase  ,    **__UpperCamelCase			)

       UpperCamelCase__	     =      projection_dim
       UpperCamelCase__	     =      logit_scale_init_value


   @classmethod
   def 						_UpperCamelCase							(	cls  ,    __UpperCamelCase  ,    __UpperCamelCase  ,    **__UpperCamelCase			):
       return cls(vision_config=vision_config.to_dict()  ,    text_config=text_config.to_dict()  ,    **__UpperCamelCase			)







   def 						_UpperCamelCase							(	self			):
       UpperCamelCase__	     =      copy.deepcopy(self.__dict__			)
       UpperCamelCase__	     =      self.vision_config.to_dict()
       UpperCamelCase__	     =      self.text_config.to_dict()
       UpperCamelCase__	     =      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,
)


lowercase__  :	Optional[Any]            =      {
    'configuration_marian': ['MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MarianConfig', 'MarianOnnxConfig'],
}

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

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

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

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

      lowercase__  :	Any            =      _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




