

import copy

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


lowercase_     =       logging.get_logger(__name__)





class 			__lowerCAmelCase					( SCREAMING_SNAKE_CASE							):
  _a						      =  """vision-text-dual-encoder"""
  _a						      =  True




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

        _lowercase     	=kwargs.pop('vision_config' )
        _lowercase     	=kwargs.pop('text_config' )

        _lowercase     	=vision_config.pop('model_type' )
        _lowercase     	=text_config.pop('model_type' )

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

        _lowercase     	=AutoConfig.for_model(lowerCAmelCase							,       **lowerCAmelCase )

        _lowercase     	=projection_dim
        _lowercase     	=logit_scale_init_value




  @classmethod
  def   A__					(    cls							,       lowerCAmelCase							,       lowerCAmelCase							,       **lowerCAmelCase )  ->			int:
        '''simple docstring'''






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




  def   A__					(    self )  ->			Any:
        '''simple docstring'''






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





import warnings

from ...utils import logging
from .image_processing_vit import ViTImageProcessor


lowercase_     =       logging.get_logger(__name__)





class 			__lowerCAmelCase					( SCREAMING_SNAKE_CASE							):




  def __init__(    self							,       *lowerCAmelCase							,       **lowerCAmelCase )  ->			None:
        '''simple docstring'''






        warnings.warn(
            'The class ViTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'
            ' use ViTImageProcessor instead.'							,       lowerCAmelCase							,       )
        super().__init__(*lowerCAmelCase							,       **lowerCAmelCase )


