


'''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 				__SCREAMING_SNAKE_CASE   (			A__   ):
      A				:							Dict    							=     'vision-text-dual-encoder'
      A				:							Optional[Any]    							=     True


      def __init__(							self							,						SCREAMING_SNAKE_CASE__=512							,						SCREAMING_SNAKE_CASE__=2.6592							,						**SCREAMING_SNAKE_CASE__		):
            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`.'''		)

            lowercase			:   Dict					   =		kwargs.pop('''vision_config'''		)
            lowercase			:   str					   =		kwargs.pop('''text_config'''		)

            lowercase			:   Optional[Any]					   =		vision_config.pop('''model_type'''		)
            lowercase			:   Union[str, Any]					   =		text_config.pop('''model_type'''		)

            if vision_model_type == "clip":
                  lowercase			:   Optional[Any]					   =		AutoConfig.for_model(SCREAMING_SNAKE_CASE__							,						**SCREAMING_SNAKE_CASE__		).vision_config
            elif vision_model_type == "clip_vision_model":
                  lowercase			:   Optional[int]					   =		CLIPVisionConfig(**SCREAMING_SNAKE_CASE__		)
            else:
                  lowercase			:   str					   =		AutoConfig.for_model(SCREAMING_SNAKE_CASE__							,						**SCREAMING_SNAKE_CASE__		)

            lowercase			:   int					   =		AutoConfig.for_model(SCREAMING_SNAKE_CASE__							,						**SCREAMING_SNAKE_CASE__		)

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


      @classmethod
      def        __lowerCamelCase			(							cls							,						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__							,						**SCREAMING_SNAKE_CASE__		):
            return cls(vision_config=vision_config.to_dict()							,						text_config=text_config.to_dict()							,						**SCREAMING_SNAKE_CASE__		)






      def        __lowerCamelCase			(							self		):
            lowercase			:   Optional[int]					   =		copy.deepcopy(self.__dict__		)
            lowercase			:   Tuple					   =		self.vision_config.to_dict()
            lowercase			:   Dict					   =		self.text_config.to_dict()
            lowercase			:   Optional[Any]					   =		self.__class__.model_type
            return output





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__a   				=      {'''configuration_yoso''': ['''YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''YosoConfig''']}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __a   				=      [
      '''YOSO_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''YosoForMaskedLM''',
      '''YosoForMultipleChoice''',
      '''YosoForQuestionAnswering''',
      '''YosoForSequenceClassification''',
      '''YosoForTokenClassification''',
      '''YosoLayer''',
      '''YosoModel''',
      '''YosoPreTrainedModel''',
  ]


if TYPE_CHECKING:
  from .configuration_yoso import YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP, YosoConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_yoso import (
        YOSO_PRETRAINED_MODEL_ARCHIVE_LIST,
        YosoForMaskedLM,
        YosoForMultipleChoice,
        YosoForQuestionAnswering,
        YosoForSequenceClassification,
        YosoForTokenClassification,
        YosoLayer,
        YosoModel,
        YosoPreTrainedModel,
    )


else:
  import sys

  __a   				=      _LazyModule(__name__, globals()['''__file__'''], _import_structure)

