

import copy

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


__A   :     Optional[Any]      =			logging.get_logger(__name__)






class    __A				(							lowerCAmelCase ):
    lowerCAmelCase_							:		int						=							"vision-text-dual-encoder"
    lowerCAmelCase_							:		Dict						=							True






    def __init__(	self			:    Dict    ,				UpperCAmelCase_			:    Dict=512    ,				UpperCAmelCase_			:    int=2.65_92    ,				**UpperCAmelCase_			:    Tuple    ):
        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`.'    )

        lowerCAmelCase				:			int    			=      kwargs.pop('vision_config'    )
        lowerCAmelCase				:			int    			=      kwargs.pop('text_config'    )

        lowerCAmelCase				:			Tuple    			=      vision_config.pop('model_type'    )
        lowerCAmelCase				:			Dict    			=      text_config.pop('model_type'    )

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

        lowerCAmelCase				:			Optional[int]    			=      AutoConfig.for_model(UpperCAmelCase_    ,				**UpperCAmelCase_    )

        lowerCAmelCase				:			int    			=      projection_dim
        lowerCAmelCase				:			List[str]    			=      logit_scale_init_value






    @classmethod
    def 	lowercase__ (	cls			:    Tuple    ,				UpperCAmelCase_			:    PretrainedConfig    ,				UpperCAmelCase_			:    PretrainedConfig    ,				**UpperCAmelCase_			:    List[Any]    ):
        return cls(vision_config=vision_config.to_dict()    ,				text_config=text_config.to_dict()    ,				**UpperCAmelCase_    )






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








from typing import TYPE_CHECKING

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


__A   :     Dict      =			{}

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

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __A   :     List[str]      =			['''BarthezTokenizerFast''']


if TYPE_CHECKING:
 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_barthez import BarthezTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_barthez_fast import BarthezTokenizerFast

else:
 import sys

 __A   :     Tuple      =			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





