





from typing import Callable, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


__lowercase				    =      logging.get_logger(__name__)

__lowercase				    =      {
    """microsoft/prophetnet-large-uncased""": (
        """https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json"""
    ),
}

class 	__snake_case					(      a_ ):






    '''simple docstring'''
    _lowerCAmelCase  =						"prophetnet"
    _lowerCAmelCase  =						["past_key_values"]
    _lowerCAmelCase  =						{
        "num_attention_heads": "num_encoder_attention_heads",
    }





    def __init__( self    :		Tuple      ,    snake_case    :		Optional[float] = 0.1      ,    snake_case    :		Optional[Union[str, Callable]] = "gelu"      ,    snake_case    :		Optional[int] = 30_522      ,    snake_case    :		Optional[int] = 1_024      ,    snake_case    :		Optional[int] = 4_096      ,    snake_case    :		Optional[int] = 12      ,    snake_case    :		Optional[int] = 16      ,    snake_case    :		Optional[int] = 4_096      ,    snake_case    :		Optional[int] = 12      ,    snake_case    :		Optional[int] = 16      ,    snake_case    :		Optional[float] = 0.1      ,    snake_case    :		Optional[float] = 0.1      ,    snake_case    :		Optional[int] = 512      ,    snake_case    :		Optional[float] = 0.02      ,    snake_case    :		Optional[bool] = True      ,    snake_case    :		Optional[bool] = True      ,    snake_case    :		Optional[int] = 0      ,    snake_case    :		Optional[int] = 2      ,    snake_case    :		Optional[int] = 32      ,    snake_case    :		Optional[int] = 128      ,    snake_case    :		Optional[bool] = False      ,    snake_case    :		Optional[float] = 0.0      ,    snake_case    :		Optional[bool] = True      ,    snake_case    :		Optional[int] = 0      ,    snake_case    :		Optional[int] = 1      ,    snake_case    :		Optional[int] = 2      ,    **snake_case    :		str      ,    ):

      """simple docstring"""





      __lowerCAmelCase								=					vocab_size
      __lowerCAmelCase								=					hidden_size
      __lowerCAmelCase								=					encoder_ffn_dim
      __lowerCAmelCase								=					num_encoder_layers
      __lowerCAmelCase								=					num_encoder_attention_heads
      __lowerCAmelCase								=					decoder_ffn_dim
      __lowerCAmelCase								=					num_decoder_layers
      __lowerCAmelCase								=					num_decoder_attention_heads
      __lowerCAmelCase								=					max_position_embeddings
      __lowerCAmelCase								=					init_std  # Normal(0, this parameter)
      __lowerCAmelCase								=					activation_function

      # parameters for prophetnet
      __lowerCAmelCase								=					ngram
      __lowerCAmelCase								=					num_buckets
      __lowerCAmelCase								=					relative_max_distance
      __lowerCAmelCase								=					disable_ngram_loss
      __lowerCAmelCase								=					eps

      # 3 Types of Dropout
      __lowerCAmelCase								=					attention_dropout
      __lowerCAmelCase								=					activation_dropout
      __lowerCAmelCase								=					dropout

      __lowerCAmelCase								=					use_cache

      super().__init__(
          pad_token_id=UpperCAmelCase_      ,    bos_token_id=UpperCAmelCase_      ,    eos_token_id=UpperCAmelCase_      ,    is_encoder_decoder=UpperCAmelCase_      ,    add_cross_attention=UpperCAmelCase_      ,    decoder_start_token_id=UpperCAmelCase_      ,    **UpperCAmelCase_      ,    )





    @property
    def 						A		( self    :		Dict				):

      """simple docstring"""





      return self.num_encoder_layers + self.num_decoder_layers





    @num_hidden_layers.setter
    def 						A		( self    :		Optional[int]      ,    snake_case    :		Optional[Any]				):

      """simple docstring"""





      raise NotImplementedError(
          '''This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and'''
          ''' `num_decoder_layers`.'''				)

'''simple docstring'''





from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


UpperCamelCase       :     Dict			=    logging.get_logger(__name__)

UpperCamelCase       :     Tuple			=    {
    """flaubert/flaubert_small_cased""": """https://huggingface.co/flaubert/flaubert_small_cased/resolve/main/config.json""",
    """flaubert/flaubert_base_uncased""": """https://huggingface.co/flaubert/flaubert_base_uncased/resolve/main/config.json""",
    """flaubert/flaubert_base_cased""": """https://huggingface.co/flaubert/flaubert_base_cased/resolve/main/config.json""",
    """flaubert/flaubert_large_cased""": """https://huggingface.co/flaubert/flaubert_large_cased/resolve/main/config.json""",
}



class   UpperCamelCase					(       a_       ):







    """simple docstring"""





    A     :    int				=			"flaubert"
    A     :    List[str]				=			{
        "hidden_size": "emb_dim",
        "num_attention_heads": "n_heads",
        "num_hidden_layers": "n_layers",
        "n_words": "vocab_size",  # For backward compatibility
    }





    def __init__(					self     :						str							,							UpperCAmelCase_     :						Optional[int]=False							,							UpperCAmelCase_     :						List[Any]=0.0							,							UpperCAmelCase_     :						List[Any]=3_0_1_4_5							,							UpperCAmelCase_     :						Union[str, Any]=2_0_4_8							,							UpperCAmelCase_     :						Tuple=1_2							,							UpperCAmelCase_     :						str=1_6							,							UpperCAmelCase_     :						Tuple=0.1							,							UpperCAmelCase_     :						str=0.1							,							UpperCAmelCase_     :						str=True							,							UpperCAmelCase_     :						Union[str, Any]=False							,							UpperCAmelCase_     :						Any=False							,							UpperCAmelCase_     :						str=False							,							UpperCAmelCase_     :						Tuple=1							,							UpperCAmelCase_     :						str=True							,							UpperCAmelCase_     :						Tuple=5_1_2							,							UpperCAmelCase_     :						List[str]=2_0_4_8**-0.5							,							UpperCAmelCase_     :						List[Any]=1e-12							,							UpperCAmelCase_     :						Tuple=0.02							,							UpperCAmelCase_     :						Any=0							,							UpperCAmelCase_     :						List[Any]=1							,							UpperCAmelCase_     :						str=2							,							UpperCAmelCase_     :						Optional[Any]=3							,							UpperCAmelCase_     :						List[str]=5							,							UpperCAmelCase_     :						str=True							,							UpperCAmelCase_     :						List[Any]="first"							,							UpperCAmelCase_     :						Any=True							,							UpperCAmelCase_     :						Union[str, Any]=None							,							UpperCAmelCase_     :						Union[str, Any]=True							,							UpperCAmelCase_     :						Any=0.1							,							UpperCAmelCase_     :						List[Any]=5							,							UpperCAmelCase_     :						List[Any]=5							,							UpperCAmelCase_     :						Union[str, Any]=0							,							UpperCAmelCase_     :						Optional[Any]=0							,							UpperCAmelCase_     :						List[Any]=2							,							UpperCAmelCase_     :						List[Any]=0							,							**UpperCAmelCase_     :						List[Any]							,							):


         """simple docstring"""







         a					:							Any							= pre_norm
         a					:							str							= layerdrop
         a					:							int							= vocab_size
         a					:							str							= emb_dim
         a					:							Any							= n_layers
         a					:							Dict							= n_heads
         a					:							Union[str, Any]							= dropout
         a					:							List[Any]							= attention_dropout
         a					:							List[str]							= gelu_activation
         a					:							int							= sinusoidal_embeddings
         a					:							Union[str, Any]							= causal
         a					:							str							= asm
         a					:							Tuple							= n_langs
         a					:							Optional[Any]							= use_lang_emb
         a					:							str							= layer_norm_eps
         a					:							Optional[Any]							= bos_index
         a					:							Union[str, Any]							= eos_index
         a					:							str							= pad_index
         a					:							List[str]							= unk_index
         a					:							Dict							= mask_index
         a					:							Optional[Any]							= is_encoder
         a					:							str							= max_position_embeddings
         a					:							Optional[Any]							= embed_init_std
         a					:							str							= init_std
         a					:							Union[str, Any]							= summary_type
         a					:							Tuple							= summary_use_proj
         a					:							Tuple							= summary_activation
         a					:							str							= summary_proj_to_labels
         a					:							List[str]							= summary_first_dropout
         a					:							Any							= start_n_top
         a					:							Optional[Any]							= end_n_top
         a					:							List[Any]							= mask_token_id
         a					:							Optional[Any]							= lang_id

         if "n_words" in kwargs:
              a					:							int							= kwargs['n_words']

         super().__init__(pad_token_id=UpperCAmelCase_							,							bos_token_id=UpperCAmelCase_							,							**UpperCAmelCase_)






class   UpperCamelCase					(       a_       ):







    """simple docstring"""





    @property
    def    SCREAMING_SNAKE_CASE_     (					self     :						str):


         """simple docstring"""







         if self.task == "multiple-choice":
              a					:							int							= {0: 'batch', 1: 'choice', 2: 'sequence'}
         else:
              a					:							Tuple							= {0: 'batch', 1: 'sequence'}
         return OrderedDict(
             [
                 ('input_ids', dynamic_axis),
                 ('attention_mask', dynamic_axis),
             ])

