






from typing import Callable, Optional, Union

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


lowerCamelCase     :							List[Any]    =logging.get_logger(__name__)

lowerCamelCase     :							List[str]    ={
    '''microsoft/xprophetnet-large-wiki100-cased''': (
        '''https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased/resolve/main/config.json'''
    ),
}





class       __a  (   lowerCamelCase_	):
 _lowerCAmelCase	:	List[Any]				=			"""xlm-prophetnet"""
 _lowerCAmelCase	:	List[Any]				=			["""past_key_values"""]
 _lowerCAmelCase	:	List[Any]				=			{
     """num_attention_heads""": """num_encoder_attention_heads""",
 }







 def __init__(		self :       List[Any]							,       SCREAMING_SNAKE_CASE :       Optional[float] = 0.1							,       SCREAMING_SNAKE_CASE :       Optional[Union[str, Callable]] = "gelu"							,       SCREAMING_SNAKE_CASE :       Optional[int] = 3_05_22							,       SCREAMING_SNAKE_CASE :       Optional[int] = 10_24							,       SCREAMING_SNAKE_CASE :       Optional[int] = 40_96							,       SCREAMING_SNAKE_CASE :       Optional[int] = 12							,       SCREAMING_SNAKE_CASE :       Optional[int] = 16							,       SCREAMING_SNAKE_CASE :       Optional[int] = 40_96							,       SCREAMING_SNAKE_CASE :       Optional[int] = 12							,       SCREAMING_SNAKE_CASE :       Optional[int] = 16							,       SCREAMING_SNAKE_CASE :       Optional[float] = 0.1							,       SCREAMING_SNAKE_CASE :       Optional[float] = 0.1							,       SCREAMING_SNAKE_CASE :       Optional[int] = 5_12							,       SCREAMING_SNAKE_CASE :       Optional[float] = 0.0_2							,       SCREAMING_SNAKE_CASE :       Optional[bool] = True							,       SCREAMING_SNAKE_CASE :       Optional[bool] = True							,       SCREAMING_SNAKE_CASE :       Optional[int] = 0							,       SCREAMING_SNAKE_CASE :       Optional[int] = 2							,       SCREAMING_SNAKE_CASE :       Optional[int] = 32							,       SCREAMING_SNAKE_CASE :       Optional[int] = 1_28							,       SCREAMING_SNAKE_CASE :       Optional[bool] = False							,       SCREAMING_SNAKE_CASE :       Optional[float] = 0.0							,       SCREAMING_SNAKE_CASE :       Optional[bool] = True							,       SCREAMING_SNAKE_CASE :       Optional[int] = 0							,       SCREAMING_SNAKE_CASE :       Optional[int] = 1							,       SCREAMING_SNAKE_CASE :       Optional[int] = 2							,       **SCREAMING_SNAKE_CASE :       Optional[int]							,       ):


      '''simple docstring'''






      UpperCamelCase__      :       Optional[Any]	    =  vocab_size
      UpperCamelCase__      :       str	    =  hidden_size
      UpperCamelCase__      :       Dict	    =  encoder_ffn_dim
      UpperCamelCase__      :       Tuple	    =  num_encoder_layers
      UpperCamelCase__      :       Dict	    =  num_encoder_attention_heads
      UpperCamelCase__      :       Dict	    =  decoder_ffn_dim
      UpperCamelCase__      :       Tuple	    =  num_decoder_layers
      UpperCamelCase__      :       List[Any]	    =  num_decoder_attention_heads
      UpperCamelCase__      :       List[Any]	    =  max_position_embeddings
      UpperCamelCase__      :       Dict	    =  init_std  # Normal(0, this parameter)
      UpperCamelCase__      :       List[Any]	    =  activation_function

      # parameters for xlmprophetnet
      UpperCamelCase__      :       str	    =  ngram
      UpperCamelCase__      :       List[Any]	    =  num_buckets
      UpperCamelCase__      :       int	    =  relative_max_distance
      UpperCamelCase__      :       Optional[int]	    =  disable_ngram_loss
      UpperCamelCase__      :       List[Any]	    =  eps

      # 3 Types of Dropout
      UpperCamelCase__      :       str	    =  attention_dropout
      UpperCamelCase__      :       str	    =  activation_dropout
      UpperCamelCase__      :       str	    =  dropout

      UpperCamelCase__      :       Tuple	    =  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  __lowercase (		self :       Optional[int]						):


      '''simple docstring'''






      return self.num_encoder_layers + self.num_decoder_layers







 @num_hidden_layers.setter
 def  __lowercase (		self :       Optional[Any]							,       SCREAMING_SNAKE_CASE :       Optional[int]						):


      '''simple docstring'''






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







import re







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     bool:
     UpperCamelCase__      :       Union[str, Any]	    =  re.compile(
         R"^(?:0|94|\+94|0{2}94)" R"7(0|1|2|4|5|6|7|8)" R"(-| |)" R"\d{7}$"      )

     return bool(re.search(__lowerCAmelCase ,   __lowerCAmelCase      )      )


if __name__ == "__main__":
 lowerCamelCase     :							Union[str, Any]    ='''0094702343221'''

 print(is_sri_lankan_phone_number(phone))