


'''simple docstring'''


import copy
from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


if TYPE_CHECKING:
     from ... import PreTrainedTokenizerBase, TensorType

__magic_name__			=      logging.get_logger(__name__)



class 	__lowerCAmelCase		(							__SCREAMING_SNAKE_CASE    ):


  '''simple docstring'''







  a_  					=							"""vision-encoder-decoder"""
  a_  					=							True






  def __init__(							self :       Any	,**_a :       List[str] ):

        '''simple docstring'''




        super().__init__(**_a )
        if "encoder" not in kwargs or "decoder" not in kwargs:
              raise ValueError(
                  f'A configuraton of type {self.model_type} cannot be instantiated because '
                  f'not both `encoder` and `decoder` sub-configurations are passed, but only {kwargs}' )

        A_						:  Dict          =				kwargs.pop("""encoder""" )
        A_						:  Union[str, Any]          =				encoder_config.pop("""model_type""" )
        A_						:  Optional[Any]          =				kwargs.pop("""decoder""" )
        A_						:  Any          =				decoder_config.pop("""model_type""" )

        A_						:  List[Any]          =				AutoConfig.for_model(_a	,**_a )
        A_						:  int          =				AutoConfig.for_model(_a	,**_a )
        A_						:  Optional[int]          =				True






  @classmethod
  def        _a							(							cls :       List[Any]	,_a :       PretrainedConfig	,_a :       PretrainedConfig	,**_a :       Any ):

        '''simple docstring'''




        logger.info("""Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config""" )
        A_						:  Optional[int]          =				True
        A_						:  Any          =				True

        return cls(encoder=encoder_config.to_dict()	,decoder=decoder_config.to_dict()	,**_a )






  def        _a							(							self :       Tuple ):

        '''simple docstring'''




        A_						:  List[Any]          =				copy.deepcopy(self.__dict__ )
        A_						:  Any          =				self.encoder.to_dict()
        A_						:  Dict          =				self.decoder.to_dict()
        A_						:  Union[str, Any]          =				self.__class__.model_type
        return output







class 	__lowerCAmelCase		(							__SCREAMING_SNAKE_CASE    ):


  '''simple docstring'''







  a_  					=							version.parse("""1.11"""    )






  @property
  def        _a							(							self :       List[Any] ):

        '''simple docstring'''




        return OrderedDict(
            [
                ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
            ] )






  @property
  def        _a							(							self :       Union[str, Any] ):

        '''simple docstring'''




        return 1e-4






  @property
  def        _a							(							self :       Union[str, Any] ):

        '''simple docstring'''




        return OrderedDict({"""last_hidden_state""": {0: """batch""", 1: """encoder_sequence"""}} )







class 	__lowerCAmelCase		(							__SCREAMING_SNAKE_CASE    ):


  '''simple docstring'''







  @property
  def        _a							(							self :       Any ):

        '''simple docstring'''




        A_						:  List[Any]          =				OrderedDict()
        A_						:  Dict          =				{0: """batch""", 1: """past_decoder_sequence + sequence"""}
        A_						:  List[Any]          =				{0: """batch""", 1: """past_decoder_sequence + sequence"""}
        A_						:  str          =				{0: """batch""", 1: """encoder_sequence"""}

        return common_inputs






  def        _a							(							self :       Optional[Any]	,_a :       "PreTrainedTokenizerBase"	,_a :       int = -1	,_a :       int = -1	,_a :       bool = False	,_a :       Optional["TensorType"] = None	,):

        '''simple docstring'''




        import torch

        A_						:  int          =				OrderedDict()

        A_						:  Dict          =				super().generate_dummy_inputs(
            _a	,batch_size=_a	,seq_length=_a	,is_pair=_a	,framework=_a )

        A_   ,					A_						:  str          =				dummy_input["""input_ids"""].shape
        A_						:  Optional[Any]          =				(batch, encoder_sequence, self._config.encoder_hidden_size)
        A_						:  Dict          =				dummy_input.pop("""input_ids""" )
        A_						:  Optional[int]          =				dummy_input.pop("""attention_mask""" )
        A_						:  Dict          =				torch.zeros(_a )

        return common_inputs







class 	__lowerCAmelCase		(							__SCREAMING_SNAKE_CASE    ):


  '''simple docstring'''







  @property
  def        _a							(							self :       int ):

        '''simple docstring'''




        pass






  def        _a							(							self :       Optional[Any]	,_a :       PretrainedConfig ):

        '''simple docstring'''




        return VisionEncoderDecoderEncoderOnnxConfig(_a )






  def        _a							(							self :       int	,_a :       PretrainedConfig	,_a :       PretrainedConfig	,_a :       str = "default" ):

        '''simple docstring'''




        A_						:  Union[str, Any]          =				encoder_config.hidden_size
        return VisionEncoderDecoderDecoderOnnxConfig(_a	,_a )




'''simple docstring'''


from ... import PretrainedConfig


__magic_name__			=      {
    'sijunhe/nezha-cn-base': 'https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json',
}



class 	__lowerCAmelCase		(							__SCREAMING_SNAKE_CASE    ):


  '''simple docstring'''







  a_  					=							NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP
  a_  					=							"""nezha"""






  def __init__(							self :       int	,_a :       Union[str, Any]=21128	,_a :       int=768	,_a :       Any=12	,_a :       List[str]=12	,_a :       str=3072	,_a :       int="gelu"	,_a :       int=0.1	,_a :       str=0.1	,_a :       Tuple=512	,_a :       List[Any]=64	,_a :       Dict=2	,_a :       List[Any]=0.02	,_a :       Optional[Any]=1e-12	,_a :       List[Any]=0.1	,_a :       Union[str, Any]=0	,_a :       Any=2	,_a :       Union[str, Any]=3	,_a :       int=True	,**_a :       int	,):

        '''simple docstring'''




        super().__init__(pad_token_id=_a	,bos_token_id=_a	,eos_token_id=_a	,**_a )

        A_						:  Tuple          =				vocab_size
        A_						:  int          =				hidden_size
        A_						:  Any          =				num_hidden_layers
        A_						:  List[Any]          =				num_attention_heads
        A_						:  Tuple          =				hidden_act
        A_						:  List[Any]          =				intermediate_size
        A_						:  List[str]          =				hidden_dropout_prob
        A_						:  Tuple          =				attention_probs_dropout_prob
        A_						:  Dict          =				max_position_embeddings
        A_						:  Optional[Any]          =				max_relative_position
        A_						:  List[Any]          =				type_vocab_size
        A_						:  int          =				initializer_range
        A_						:  Tuple          =				layer_norm_eps
        A_						:  Dict          =				classifier_dropout
        A_						:  int          =				use_cache
